I am trying to write a program that has the ability to search through an sqlite database of different sites that have their geographical coordinates and i need to be able to return the closes five coordinates to the users current position, I already have used reverse-geocoding to find my current position and the distance from the sites, however I have not been able to display the closest five. Any help would be much appreciated, Thank you!
Asked
Active
Viewed 30 times
0
-
How accurate do you need to be? To get it 100% right every time, there's a lot of math involved. If there's enough distance between your stored locations that you can afford to be a little "fuzzy" with the relative distances, you can probably get away with some simple arithmetic. – alroc Jan 04 '15 at 22:39
-
It has to be somewhat accurate because there are sites that are all around the united states and even just being off by .001 could be a completely different site, it is a database of of 60,000 sites around the U.S. – user252692 Jan 04 '15 at 23:23
-
Are you using [SpatiaLite](http://en.wikipedia.org/wiki/SpatiaLite) with your database? – alroc Jan 05 '15 at 01:30
-
No I am not, would that make this task easier if I add that on to the database? – user252692 Jan 06 '15 at 16:57
-
If you're doing a lot of geospatial work (including distance calculations) with your data, then yes, it probably would be to your advantage to use it (try it on a test copy of your database and find out for yourself). I haven't used it myself, but have used the geospatial features of another RDBMS and it beats writing my own code to do the calculations. – alroc Jan 06 '15 at 16:59