0

I use openlayers 6 in my project. When initializing map I get this error in browser:

Uncaught AssertionError: Assertion failed. See https://openlayers.org/en/v6.0.1/doc/errors/#32 for details.
    at new AssertionError (http://localhost:1234/mapApp.3f0ed956.js:304:20)
    at assert (http://localhost:1234/mapApp.3f0ed956.js:4706:11)
    at makeInverse (http://localhost:1234/mapApp.3f0ed956.js:9565:23)
    at CompositeMapRenderer.MapRenderer.calculateMatrices2D (http://localhost:1234/mapApp.3f0ed956.js:22861:32)
    at CompositeMapRenderer.renderFrame (http://localhost:1234/mapApp.3f0ed956.js:23178:10)
    at Map.PluggableMap.renderFrame_ (http://localhost:1234/mapApp.3f0ed956.js:17137:20)
    at Map.<anonymous> (http://localhost:1234/mapApp.3f0ed956.js:15948:12)

When I click in error on first row I get description of the error on openlayers site:

Transformation matrix cannot be inverted.

Here is my map initialization:

let extent = boundingExtent([West, South, East, North]);
let mapCenter = getCenter([West, South, East, North]);
const israeliTM = getProjection('EPSG:2039');

const map = new Map({
        target: 'map',
        layers: [
            new TileLayer({ source: new OSM() })
        ],
        view: new View({
            extent: extent,//works ok when commited
            projection: israeliTM,
            center: mapCenter,
            zoom: 10

        })
    });

When I put on comment this row extent: extent in map initialization above I don't get any errors, so it seems that extent function cause the error.

Any idea why when I try to set extent on map init I get the error?

3
  • 1
    The syntax for boundingExtent should be boundingExtent([[West, South], [East, North]]); but it is much simpler to use let extent = [West, South, East, North]; – Mike Oct 15 '19 at 10:50
  • @Mike, thanks for post.Is there any way create bound rectangle from array in openlayers 6 as it was possible in openlayers 2 using OpenLayers.Bounds? – Michael Oct 15 '19 at 13:31
  • 1
    In OpenLayers 3+ you just pass the array – Mike Oct 15 '19 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.