Turf: line-intersect: Update to rbush is causing an exception to be thrown

Created on 15 May 2019  路  7Comments  路  Source: Turfjs/turf

The geojson-rbush module which @turf/line-intersect depends on, has a dependency on rbush with a version specification of *
rbush was just published at version 3.0.0
This has now broken geojson-rbush with the following exception:

TypeError: Cannot set property '_maxEntries' of undefined
at RBush (/data/github/geopackage-js/node_modules/rbush/rbush.js:65:22)
at Object.geojsonRbush [as default] (/data/github/geopackage-js/node_modules/geojson-rbush/index.js:22:16)
at lineIntersect (/data/github/geopackage-js/node_modules/@turf/line-intersect/index.js:52:39)
geojson-rbush should depend on version 2 of rbush

GeoJSON line: https://gist.github.com/danielbarela/8efefdf5d423d450dfe8a70980fee861
GeoJSON Polygon: https://gist.github.com/danielbarela/8abdd2e1779cc9619091d8090ed82f04

Most helpful comment

We ran into this issue as well. For the time being, we manually specified rbush version 2.0.2 in our package.json. This will prevent geojson-rbush from installing the newer version since it doesn't specify its own version. This has resolved the issue until it is remedied in geojson-rbush.

So, we added this line to package.json:

"rbush": "2.0.2",

All 7 comments

We ran into this issue as well. For the time being, we manually specified rbush version 2.0.2 in our package.json. This will prevent geojson-rbush from installing the newer version since it doesn't specify its own version. This has resolved the issue until it is remedied in geojson-rbush.

So, we added this line to package.json:

"rbush": "2.0.2",

geojson-rbush has been patched today and this issue is fixed as of version 3.1.2.

@danielbarela can this issue be closed?

I would think so. Master has

https://github.com/Turfjs/turf/blob/b6cb691e0d23293ca0c881fe561f0e8a4536ad6a/packages/turf-line-intersect/package.json#L54

which will include the patched version of geojson-rbush.

I believe this can be closed

This should not be closed. Anyone knows what exactly causes the error when using rbush 3.0?
In the index.js file I changed:
function geojsonRbush(maxEntries) {
var tree = rbush(maxEntries);
to:
var tree = new rbush(maxEntries);

and everything works. Would you accept this as a PR?

Thanks.

Was this page helpful?
0 / 5 - 0 ratings