Closed flekschas closed 6 years ago
You're right — this would be a nice improvement. Flatbush already does this: https://github.com/mourner/flatbush/blob/master/index.js#L47 — let's do the same in KDBush. Want to do a PR?
Sounds good! I am happy to piece together PR.
Just found kdbush
and want to add an export/import functionality, similar to Flatbush.from
. Will wait for this PR.
First of all, thanks for providing this awesome lib! This is more a question rather than a bug report.
I notice that one can specify the dtype using the 4th parameter of the constructor, which is used for the index and coords array: https://github.com/mourner/kdbush/blob/master/src/index.js#L18-L19
Would it make sense to store the indices in anything other than a typed
int
array? I am asking myself this because storing thepoints
as floats would automatically setthis.ids
to floats as well.As an idea, we could fix
this.ids
to its most efficient dtype using something like this