I have been researching how best to retrieve subsets of location data from a MySQL database. This answer had links to many hope-inducing articles, but none of which provided any concrete, simple examples:
Database: Best performance way to query geo location data?
Let’s say I have a database with a table PLACES. PLACES could have millions of entries in it. Each row has column types LAT, LON, and NAME.
I would like to form a functional statement from the following semi-pseudocode:
Select * from PLACES where distance((LAT, LON), (givenLat, givenLon)) < 100 meters;
return *[NAME];
It’s fairly simple, but though I’ve used MySQL extensively I have never used the spacial extensions before. I am willing to work with them but I am also willing to write custom functions if that would be faster. The above query is literally what I need to produce. Any pointers beyond the docs would be very helpful, thank you.
Sergey Benner deservers the credit for this answer (I just want to close the question). His comment above links to several outstanding and functional resources on the topic. I also discovered this resource which works perfectly if you are working on iOS:
http://www.thismuchiknow.co.uk/?p=71