JonnoTheDev Posted June 2, 2009 Share Posted June 2, 2009 I have a design issue. Lets say I have a table of landmarks each with a longitude and latitude value. I want to be able to extract other landmarks within a given distance i.e. 6 miles. Has anyone a soluition to this with regards querying. Quote Link to comment https://forums.phpfreaks.com/topic/160647-longitude-latitude/ Share on other sites More sharing options...
JonnoTheDev Posted June 2, 2009 Author Share Posted June 2, 2009 I have this. It works but does anyone see an issue on large amounts of data? SQRT(POW(69.1 * (latitude - $startlat), 2) + POW(69.1 * ($startlng - longitude) * COS(latitude / 57.3) , 2)) AS distance Quote Link to comment https://forums.phpfreaks.com/topic/160647-longitude-latitude/#findComment-847833 Share on other sites More sharing options...
kickstart Posted June 2, 2009 Share Posted June 2, 2009 Hi Suspect it is not going to be nice, but not sure you have a choice. What format is the longitude / latitude in? All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/160647-longitude-latitude/#findComment-847841 Share on other sites More sharing options...
JonnoTheDev Posted June 2, 2009 Author Share Posted June 2, 2009 What format is the longitude / latitude in? Do you mean data type? If so lon / lat values are stored in a float. Quote Link to comment https://forums.phpfreaks.com/topic/160647-longitude-latitude/#findComment-847868 Share on other sites More sharing options...
kickstart Posted June 2, 2009 Share Posted June 2, 2009 Hi When playing with GPS logs, long / lat have been stored 3 different ways depending on whether you are dealing with degrees, minutes and seconds, or degree and fraction, etc. The GPS logging software I use on a PDA sometimes can generate all 3 formats. All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/160647-longitude-latitude/#findComment-847876 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.