Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Given a database of GPS points, a center GPS location, and a radius R (in meters), how can I find all points in the database that are within a distance of R of the center point? Will the distance iso-lines be an ellipse?

share|improve this question
2  
By definition, distance isolines are circles. In the sense that all circles are special cases of ellipses, the answer to your last question is "yes." More significantly, these isolines may appear as ellipses (or even more distorted shapes) when drawn on a map, depending on the projection and the magnitudes of the distances. For smallish distances (often 1000 km or less), the isolines will be extremely close to circular on any map using a conformal projection. –  whuber Feb 29 '12 at 16:48
1  
Please consider indicating (by means of a tag or within the question itself or both) what software you intend to use. –  whuber Feb 29 '12 at 16:49
2  
@whuber the queries would be over small distances (likely in the range: 10m - 10km). I'm implementing my own software, so I'd like to understand the specific equations I'd need in order to compute distances and convert distances in 'meters' (from a given location) back into GPS coordinates. –  Nick Feb 29 '12 at 16:56
1  
Nick, how accurate do the formulas need to be and in what coordinates are the GPS points recorded? How many points are involved? What database is being used? Unless you have unusual needs, it is possible your question is already answered on this site. A search on distance and formula might do the trick. –  whuber Feb 29 '12 at 17:03
1  
Nick, The fist step for this problem is to perform the conversion (projection) between coordinate systems (lat/lon <-> m). Are you sure that you want to implement that yourself? There are good libraries available that do that for you and the distance calculation also, see OGR/GDAL. –  Pablo Feb 29 '12 at 18:46

3 Answers 3

up vote 5 down vote accepted

For such short distances and since you are doing the coding yourself, the flat earth equations would probably be a good enough approximation but it depends on your accuracy requirements.

Compute the distance from latp,lonp to lat1/lon1 via the equirectangular projection:

p1 = (lonp - lon1) cos ( 0.5*(latp+lat1) ) //convert lat/lon to radians
p2 = (latp - lat1)
distance = EarthRadius * sqrt( p1*p1 + p2*p2)
use EarthRadius = 6371000 meters and your distance will be in meters

Latp/Lonp will be your reference lat/lon (in radians!). Lat1/Lon1 will be the point you are testing. Once you have distance, it is an easy test to determine if the point lies within your circle.

Reference: section Equirectangular approximation at the site: http://www.movable-type.co.uk/scripts/latlong.html

share|improve this answer

Vincenty's formulae devised by Thaddeus Vincenty is also worth it.

You can head to the page entitled Vincenty formula for distance between two Latitude/Longitude points.

Other implementations:

share|improve this answer

For a spherical earth I have found that the formulas in the Aviation Formulary. For the distances you are working these distance calculations are more than adequate.

Unless of course your GIS package includes these calculations, or tools to select by buffering and intersecting.

share|improve this answer
    
Very informative link, thanks. –  Nick Mar 1 '12 at 15:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.