mourner / geokdbush Goto Github PK
View Code? Open in Web Editor NEWThe fastest spatial index for geographic locations in JavaScript
License: ISC License
The fastest spatial index for geographic locations in JavaScript
License: ISC License
Just a heads up, I've submitted a PR to add the Typescript definition to geokdbush
.
Once it's merged and published, we can add @types/geokdbush
to this README.
The code from example doesn't work for me, but when I add the new
operator to kdbush, it starts working:
var index = kdbush(points, (p) => p.lon, (p) => p.lat);
should become
var index = new kdbush(points, (p) => p.lon, (p) => p.lat);
Hi Vladimir
Do you think there is a chance to get distance with a result somehow?
IL
kdbush 4.x changed the internal interface so that index.points no longer exists, but the latest version of geokdbush still relies on it.
I was able to work around it by manually setting index.points to an array matching what I wanted (lng/lat points).
It might make sense to just return an index.
Hi @mourner,
First of all, thank you so much for your work on this project. I've tried several libraries, and this is by far the fastest nearby geo library I've used in a few non-commercial projects.
Unfortunately, it's not working anymore due to the lack of CommonJS support in kdbush. I've integrated geokdbush into my web application, which I cannot easily migrate to ESM. It would be different if it was a simple standalone script running on the backend.
If possible, would it be feasible to reintroduce CommonJS support to kdbush and update this library to reflect v4.* of kdbush? That would be greatly appreciated.
Thanks!
We use kdbush index and used kdbush.within
for a lot of time. Recently we started to use geokdbush and it sometimes failed to find the NN on some locations (especially the ones that were really very close). We have used 50.000 set with lat,lons and I was unable to replicate where it failed, but was unable to trace the error inside the lib (since chrome dev tools killed my CPU when trying to investigate content of index).
I am sure kdbush index was correct and contained all the points since kdbush worked fine.
We switched back to kdbush.within
and all is ok now.
If you find it useful I can send you the data set for investigation and piece of code but I consider kdbush.within
to be much faster.
KDBush already has a range
method, but geokdbush
should have a wrapper around it that handles the date line wrapping.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.