我有一个包含GPS坐标经度和纬度的mysql表。查找接近距离GPS
我想提出一个请求,以获得一个给定位置附近的记录。
我已经试过2个请求和合并的结果,但它不是正确的......
//Req 1 - bigger than my position
$req1 = mysql_query('SELECT * FROM table WHERE latitude >= 47.6621549 and longitude >= 2.3547128 ORDER BY latitude, longitude');
//Req 2 - samller than my position
$req2 = mysql_query('SELECT * FROM table WHERE latitude <= 47.6621549 and longitude <= 2.3547128 ORDER BY latitude, longitude');
是否有可能有一个请求,使其? 有了这个,我想通过gmap distance API检索给定位置的距离,我认为这不是问题...
感谢您的回答。
这个答案可能会帮助您:http://stackoverflow.com/questions/1006654/fastest-way-to-find-distance-between-two-lat-long-points – shannonman
这很可能是相关的你的问题http://dba.stackexchange.com/questions/4214/how-to-best-implement-nearest-neighbour-search-in-mysql –