imanta Posted January 12, 2010 Share Posted January 12, 2010 I am building a URL callback that returns some set of data based on the latitude and longitude of the user. I have a huge database of items that all have their own latitude and longitude and basically I just want to return the items that are within X miles of the user's. It is very simple and you see stuff like this all the time, but I am not sure where to begin. I do not have a UI to work with so I must depend entirely on back-end interfaces as I only get an HTTP request and will return structured results (XML). Any direction, pointers, thoughts, etc are much appreciated. Thanks! Link to comment https://forums.phpfreaks.com/topic/188139-need-some-help-getting-started-finding-locations-near-me/ Share on other sites More sharing options...
crabfinger Posted January 12, 2010 Share Posted January 12, 2010 This is what google got me in about 2 seconds with the search term "php distance between two points on a map" http://snipplr.com/view/9566/distance-between-two-points/ Link to comment https://forums.phpfreaks.com/topic/188139-need-some-help-getting-started-finding-locations-near-me/#findComment-993286 Share on other sites More sharing options...
imanta Posted January 12, 2010 Author Share Posted January 12, 2010 I did search and I have this code, but the way this is works is that I would need compare the user's info with every single item in the database and then check the result against the radius (my X). I was actually hoping to come up with a SQL based way to turn this into a SELECT statement to keep the load down. Does that make sense? Link to comment https://forums.phpfreaks.com/topic/188139-need-some-help-getting-started-finding-locations-near-me/#findComment-993301 Share on other sites More sharing options...
crabfinger Posted January 12, 2010 Share Posted January 12, 2010 Try this then http://code.google.com/apis/maps/articles/phpsqlsearch.html Link to comment https://forums.phpfreaks.com/topic/188139-need-some-help-getting-started-finding-locations-near-me/#findComment-993924 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.