Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to retrieve bounding boxes/generate bounding boxes #41

Open
paddymul opened this issue May 29, 2023 · 3 comments
Open

How to retrieve bounding boxes/generate bounding boxes #41

paddymul opened this issue May 29, 2023 · 3 comments
Labels

Comments

@paddymul
Copy link

I am looking to serialize indexes into smaller chunks for better performance in a KV store.
If there are boxes at each tree level, I would like to be able to get the pre-configured bounding box coordinates from the tree root. Then I will construct a kdbush from just those coordinates.

I'm still not 100% clear on the rtree algorithm. If there is a node size of 16, does that mean that the first level has 16 leaves?

I would be happy to use a combination of flatbush and kdbush.

@mourner
Copy link
Owner

mourner commented May 29, 2023

I'm a little confused, can you please describe your question in more detail? KDBush is already fully serializable since v4, with the whole index stored as index.data ArrayBuffer which can then be deserialized with KDBush.from(data).

@paddymul
Copy link
Author

So I want to start with an index of 350k points, this will serialize to an index of approximately 6MB. I want to split this index into separate smaller indexes (hopefully each smaller index can use only a 16bit index, so split it into 8 sub indexes with around 45k points in each). My data, and my application deals with very localized data, so the first step is to find the appropriate localized index, then just work inside of that. I'm guessing I would use Flatbush for the first smaller index, then kdbush for the smaller indexes.

I will be building my app on top of cloudlfare workers, and cloudflare KV. So each request requires downloading a whole index (it doesn't stay resident in memory). Essentially downloading too big an index times out a response.

@phobrain
Copy link

Maybe if you build a temporary global tree, and then descend it while building the final subtree arrays. The global tree could even be done with a different package in different software, if convenient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants