georbush icon indicating copy to clipboard operation
georbush copied to clipboard

TypeError: Cannot set property '_maxEntries' of undefined

Open waedbara opened this issue 5 years ago • 4 comments

Hello , I try use georbush but TypeError: Cannot set property '_maxEntries' of undefined error appeared when using var index = rbush(9, ['.lon', '.lat', '.lon', '.lat']); , Any help ? Thanks

waedbara avatar Jan 06 '20 19:01 waedbara

I believe this is due to the changes made in v3.0 of rbush recently. https://github.com/mourner/rbush/releases

This was written for v2 of rbush. I don’t currently have time to update the library for this - however please feel free to look through the code and issue a pull request if you need this ASAP.

cirlam avatar Jan 06 '20 21:01 cirlam

Thanks @cirlam When I use new RBush(9, ['.lon', '.lat', '.lon', '.lat']) instead of RBush(9, ['.lon', '.lat', '.lon', '.lat']) the error disappeared and the result => RBush { _maxEntries: 9, _minEntries: 4, data: { children: [], height: 1, leaf: true, minX: Infinity, minY: Infinity, maxX: -Infinity, maxY: -Infinity } } is my result valid?

waedbara avatar Jan 07 '20 09:01 waedbara

Looks good to me! Try adding some items into the R Tree - the minX,maxY etc. values should change according to the item's location within the R Tree.

cirlam avatar Jan 07 '20 10:01 cirlam

I try to add 2 items :

var index = new rbush(9, ['.lon', '.lat', '.lon', '.lat']);
for(i=0; i<n; i++) {
    var city = us_cities[i];
    index.insert(city);
}

The response { children: [ { cityId: 4046255, name: 'Bay Minette', altName: '', country: 'US', featureCode: 'PPLA2', adminCode: 'AL', population: 9118, loc: [Object] }, { cityId: 4046274, name: 'Edna', altName: '', country: 'US', featureCode: 'PPLA2', adminCode: 'TX', population: 5792, loc: [Object] } ], height: 1, leaf: true, minX: NaN, minY: NaN, maxX: NaN, maxY: NaN } what is the values of minX,minY,maxX,maxY because the city has { type: 'Point', coordinates: [ -87.77305, 30.88296 ] } with 2 values ? and these values resprent a bounding box?

waedbara avatar Jan 07 '20 11:01 waedbara