mourner / rbush

RBush — a high-performance JavaScript R-tree-based 2D spatial index for points and rectangles

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

non-root bbox

calvinmetcalf opened this issue · comments

it would be nice to have an easy way to tell rbush that it can find the bbox array somewhere besides the root, i.e. if you have an object that has it's bbox in item.bbox, maybe pass a 'string' to format instead of an array and have _initFormat do this for strings, can do a pull.

The current format handling allows you do it like this (perhaps it's not obvious and I should add a note to the readme):

rbush(9, ['.bbox.minLng', '.bbox.minLat', '.bbox.maxLng', '.bbox.maxLat']);

For even more complex situations, you can redefine methods toBBox, compareMinX, compareMinY as per #14.

yeah I guess I meant way to do it easier then rbush(9,['.bbox[0]','.bbox[1]','.bbox[2]','.bbox[3]'])

@calvinmetcalf I thought that was easy enough... How would a perfect API look in your opinion?

a bit like #23

With the recent API change in 2.0, where bbox is no longer an array by default, I think we should keep format options as is.