georbush
georbush copied to clipboard
TypeError: Cannot set property '_maxEntries' of undefined
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
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.
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?
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.
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?