mourner / kdbush

A fast static index for 2D points
ISC License
629 stars 69 forks source link

Add .toJSON() and .fromJSON() #25

Closed callumacrae closed 1 year ago

callumacrae commented 5 years ago

API is slightly different to rbush (didn't realise it had this when I started), can change if required.

Can also change it to just be new KDBush(data), as it can detect if it's an object or array.


My case for this is that we're deploying something on a serverless architecture that reads points from redis - sorting on every single request is super inefficient and is adding a lot of overhead, this change would enable us to store already sorted data in redis.