Drexel dragonThe Math ForumDonate to the Math Forum

Ask Dr. Math - Questions and Answers from our Archives
_____________________________________________
Associated Topics || Dr. Math Home || Search Dr. Math
_____________________________________________

Formula for Radial Latitudes and Longitudes

Date: 10/15/2002 at 00:28:44
From: Bill Tait
Subject: Formula for radial latitudes and longitudes

I have a database of places that lists a latitude and longitude for 
each place. I want to make a radius search tool that returns all 
places based on latitude/longitude within a certain radius (say 
5 miles) of a given place. I have already created one that will return 
results of a square or rectangle, but I can't figure out how to do 
this when it's a radius. Obviously calculating the area is easy, but 
to display a list of every lat/lon within that area is the problem.

Any ideas?

Regards,
Bill Tait


Date: 10/15/2002 at 08:31:37
From: Doctor Rick
Subject: Re: Formula for radial latitudes and longitudes

Hi, Bill.

We get lots of questions like this. Here's what you need to do. For 
each point in your database, compute the distance between that point 
and the given point. If it's less than the specified distance, add it 
to your list of places within the circle. I suggest the following 
algorithm for calculating distance:

   Haversine Formula
   http://mathforum.org/library/drmath/view/51879.html 

If you're only considering short distances like 5 miles, you can use 
an approximation for short distances in which the earth can be 
regarded as flat. It's explained here:

   Circle of Radius 1 km around Given Latitude/Longitude
   http://mathforum.org/library/drmath/view/61135.html 

Using this method, you will convert the longitude (a2) and latitude 
(b2) of each point, with a1 and b1 equal to the longitude and 
latitude of the given point, to x and y, then calculate

   r^2 = x^2 + y^2

If this is less than the given distance squared, add the point to the 
list. This approximation requires fewer trig functions, but it still 
requires one. It only needs to be computed once for the given point, 
however, not for each point in the database.

- Doctor Rick, The Math Forum
  http://mathforum.org/dr.math/ 
Associated Topics:
College Euclidean Geometry
College Higher-Dimensional Geometry
High School Euclidean/Plane Geometry
High School Higher-Dimensional Geometry

Search the Dr. Math Library:


Find items containing (put spaces between keywords):
 
Click only once for faster results:

[ Choose "whole words" when searching for a word like age.]

all keywords, in any order at least one, that exact phrase
parts of words whole words

Submit your own question to Dr. Math

[Privacy Policy] [Terms of Use]

_____________________________________
Math Forum Home || Math Library || Quick Reference || Math Forum Search
_____________________________________

Ask Dr. MathTM
© 1994-2013 The Math Forum
http://mathforum.org/dr.math/