Code Monkey home page Code Monkey logo

Comments (7)

 avatar commented on June 17, 2024

KD-trees can't, in general, be built incrementally. So, adding this feature would mean rewriting the library from scratch.

That's not necessarily a bad thing, though. Give me some time to ponder potential solutions and I'll see what I can do.

from sphere-knn.

turban avatar turban commented on June 17, 2024

ok, thanks!

from sphere-knn.

 avatar commented on June 17, 2024

My original plan was to use a bounding volume hierarchy (BVH), but that won't work—it can very easily become far too unbalanced to be practical.

Another option that doesn't work too well is a hierarchical grid—it works beautifully if your points are distributed uniformly across the globe, but if you have 10,000 points in downtown Manhattan, the whole thing falls apart.

So, I'm going to have to survey the literature on how to do this effectively—maybe some kind of probabilistic or self-balancing data structure. I'll keep noodling on it!

from sphere-knn.

turban avatar turban commented on June 17, 2024

Good luck noodling! It's great to have these possibilities available in JavaScript. sphere-knn and crossfilter is a good match to search and filter geospatial data.

from sphere-knn.

 avatar commented on June 17, 2024

Here's a dumb question: how many points are you looking to search and filter? If it's not too many, the stupid solution of just keeping a list and searching through it linearly would work wonders :p

from sphere-knn.

turban avatar turban commented on June 17, 2024

It could be several thousands points, and I would like the the search to be instant so a tree structure is great. Updates are not happening that often, so recreating the tree structure on each data update is acceptible, it would just be a nice optimisation if possible. Crossfilter allows me to add data with the add method: https://github.com/square/crossfilter/wiki/API-Reference#crossfilter_add

from sphere-knn.

 avatar commented on June 17, 2024

Well, be careful not to optimize prematurely: several thousand points is nothing these days, and the search would still almost certainly be instant. (It'll probably get slow if you start using tens of hundreds of thousands, though.)

I'll try hacking up a simple thing and run some tests on it on my end.

from sphere-knn.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.