"Uncaught TypeError: Cannot read property 'id' of undefined" in clipExtract function RRS feed

  • Question

  • I figured this out, but thought it a good idea to pass on my experience for any others porting from v7 to v8.

    The clipExtract() function seems to be receiving an array of primitives (n) and  the map's MBR (t).

    It then loops through them all and does its clipping I assume. The problem appears to be that it is receiving Layer instances which it cannot handle.

    If you look at the screencap you can see the array being passed in and all elements up to 130 are pushpins. But 131 on are Layers and that is where I am getting the error because a Layer does have a crs property.

    Why do I have Layers in a Layer? Well I am porting from v7 to v8 and I was using entityCollections, specifically I was using a customized version of Ricky Brundritts's Well Known Text module and the previous version would - it might have been my modifications, I don't want to accuse him of anything now ;) - create an entityCollection when converting MultiPolygons.

    As part of my porting to v8 I am in the middle of changing all of my entityCollections to Layers, including the WKT module, and did the minimum refactoring to make that work.

    I noticed that there is now an official WKT module which I must assume knows about Layers and ignores entityCollections, and sure enough moving over to that solved my problem. It now returns an array of Polygons if you pass in a MultiPolygon,

    - Brad

    Tuesday, August 29, 2017 10:19 PM


  • The WKT module in V8 doesn't use layers for multi-shapes and instead simply passes back an array for shapes. True support multi-shapes in V8 is on the feature request list, so hopefully it will get added to V8 in the future.

    [Blog] [twitter] [LinkedIn]

    Tuesday, August 29, 2017 10:58 PM