I was wondering if anyone could help me with Longitude and Latitude calculations.
What I am trying to do is see if a longitude and latitude supplied by a user falls within a pre-defined circular area (unfortunately it has to be circular, it would have been easy working with a rectangular area)
The information I have is:
- The centre point (longitude and latitude) of the circular area and the radius of the area in miles. (stored in database)
- User supplied longitude and latitude co-ordinates (supplied via web site)
I am new to working with longitude and latitudes and not really sure where to start.
Any help would be greatly appreciated.
Thanks and regards
John
Longitude and Latitude Calculations
Moderator: General Moderators
-
john_mcc1983
- Forum Newbie
- Posts: 1
- Joined: Wed Oct 08, 2008 6:41 am
Re: Longitude and Latitude Calculations
This should help.

No seriously, looking at wikipedia it seems like it's not that simple. Maybe you could try using the google maps api.

No seriously, looking at wikipedia it seems like it's not that simple. Maybe you could try using the google maps api.
Re: Longitude and Latitude Calculations
Do some googling for 'haversine', 'haversine formula' and 'haversine distance', there's implementations for php/mysql/any other language you can think of.
Another alternative is the mysql spatial extension, never used it but seen it recommended by others, http://dev.mysql.com/doc/refman/5.0/en/ ... sions.html
Another alternative is the mysql spatial extension, never used it but seen it recommended by others, http://dev.mysql.com/doc/refman/5.0/en/ ... sions.html