Posted By

muximus on 06/07/11


mysql longitude GPS latitude poi

Versions (?)

Get closet location(POI)

 / Published in: MySQL

Get closest location to a set of gps coordinates (x, y) given a database table with columns lat(latitude) and lng(longitude)

  1. SELECT * FROM tb_location ORDER BY SQRT(POWER((y-lng), 2)+POWER((x-lat),2)) ASC LIMIT 1;

Report this snippet  

You need to login to post a comment.