Closest GPS coordinate to input

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
cairoDev
Forum Newbie
Posts: 1
Joined: Fri Jan 07, 2011 7:15 am

Closest GPS coordinate to input

Post by cairoDev »

Hi everyone,

I have a mysql table with following structure

Table Point
=============
Point_ID int
Point_ltd float(8,6)
Point_lng float(8,6)

given a user's gps coordinates (x,y) how can i get the closest point from above table "maybe within 10 - 100 m" to the user's input? using either mysql query or even using php. I think mysql query would be more efficient, right...!

thank you:)
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Closest GPS coordinate to input

Post by josh »

mysql query. great circle algorithm. tons of open source implementations.

http://www.google.com/search?rlz=1C1CHO ... rcle+mysql
Post Reply