Get closet location(POI)


/ Published in: MySQL
Save to your folder(s)

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


Copy this code and paste it in your HTML
  1. select * from tb_location ORDER BY SQRT(POWER((y-lng), 2)+POWER((x-lat),2)) ASC LIMIT 1;

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.