Note that there are some explanatory texts on larger screens.

plurals
  1. POSpatial index/query (finding k nearest points)
    primarykey
    data
    text
    <p>I have +10k points (latitude, longitude) and I'm building an app that shows you the k nearest points to a user's location. </p> <p>I think this is a very common problem and I don't want to reinvent the wheel. I'm learning about Quadtrees. It seems to be a good approach to solve this spatial problem.</p> <p>I'm using these tools:</p> <ul> <li>Python 2.5</li> <li>MySQL</li> <li>MongoDb</li> </ul> <p>Building the Quadtree is not that hard: <a href="http://donar.umiacs.umd.edu/quadtree/points/pointquad.html" rel="nofollow">http://donar.umiacs.umd.edu/quadtree/points/pointquad.html</a> But once I've created the tree and saved it to a db (MySQL or MongoDb), how I run the query?</p> <p>I need to run queries like these:</p> <ol> <li>Find all points within 10 km of the user's location.</li> <li>Find the 6 (or at least 6) nearest points to the user's location.</li> </ol> <p>What's the standard and common approach to do it?</p> <p><strong>EDIT 1:</strong></p> <p>I've loaded the +10k points into MongoDB (Geospatial indexing) and it works fine at first glance. Anyway I've found <a href="http://postgis.refractions.net/" rel="nofollow">PostGis</a>:</p> <blockquote> <p>PostGIS is an extension to the PostgreSQL object-relational database system which allows GIS (Geographic Information Systems) objects to be stored in the database. </p> </blockquote> <p>So I think I'll give PostGis a try.</p> <p>I've also found <a href="https://simplegeo.com/" rel="nofollow">SimpleGeo</a>. You can store points/places in the cloud and then query them via an API: <a href="https://simplegeo.com/docs/tutorials/python#how-do-radial-nearby-query" rel="nofollow">https://simplegeo.com/docs/tutorials/python#how-do-radial-nearby-query</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload