Skip to content

turf.intersect cryptic error #405

@Calvein

Description

@Calvein

I have 2 arrays of features, for each of one of my arrays, I'm trying to get which feature of the other array overlaps the most with it.
To do so, I'm iterating over my first array and I check the area of each intersection (if they intersect).
For some reasons, turf.intersect have problems with some features, and the error isn't helpful at all.

I've linked a test case and here is my shapes, I'm testing the red shape on the orange ones.

/my-path/node_modules/jsts/dist/jsts.min.js:15
var t=new I;return this.root.addAllItems(t),t},remove:function(t,e){var n=Pi.ensureExtent(t,this.minExtent);return this.root.remove(n,e)},collectStats:function(t){var e=t.getWidth();e<this.minExtent&&e>0&&(this.minExtent=e);var n=t.getHeight();n<this.minExtent&&n>0&&(this.minExtent=n)},depth:function(){return null!==this.root?this.root.depth():0},isEmpty:function(){return null===this.root},interfaces_:function(){return[Fe,u]},getClass:function(){return Pi}}),Pi.ensureExtent=function(t,e){var n=t.getMinX(),i=t.getMaxX(),r=t.getMinY(),s=t.getMaxY();return n!==i&&r!==s?t:(n===i&&(n-=e/2,i=n+e/2),r===s&&(r-=e/2,s=r+e/2),new C(n,i,r,s))},Pi.serialVersionUID=-0x678b60c967a25400;var po=Object.freeze({Quadtree:Pi}),vo=Object.freeze({STRtree:ke}),mo=Object.freeze({quadtree:po,strtree:vo}),yo=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"];e(bi.prototype,{read:function(t){var e=vo

TypeError: Cannot read property 'apply' of undefined
    at bi.Eo.GeometryCollection (/my-path/node_modules/jsts/dist/jsts.min.js:15:4336)
    at bi.e.write (/my-path/node_modules/jsts/dist/jsts.min.js:15:1281)
    at _i.e.write (/my-path/node_modules/jsts/dist/jsts.min.js:15:4885)
    at Object.intersect (/my-path/node_modules/turf-intersect/index.js:77:34)
    at /my-path/bug/test.js:11:29
    at Array.forEach (native)
    at Object.<anonymous> (/my-path/bug/test.js:10:23)
    at Module._compile (module.js:397:26)
    at Object.Module._extensions..js (module.js:404:10)
    at Module.load (module.js:343:32)

📦 bug.tar.gz

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions