Solved

# How to calculate the latitude from distance

Posted on 2006-05-25
692 Views
If I have a latitude/longitude value and DISTANCE value, How can I compute the latitude/longitude which is at “DISTANCE” miles from the given latitude/longitude value?

0
Question by:deeptinayak

LVL 8

Expert Comment

This should get you started with your assignment...

hec",)
0

LVL 84

Accepted Solution

There are an infinite number of  latitude/longitude values which are at “DISTANCE” miles from a given latitude/longitude value.  (Unless “DISTANCE” is 0 or half way around the world)
Assuming the world is a sphere and “DISTANCE” is measured along a great circle.
“DISTANCE” =
arcsin(sqrt(
(sin(latitude1)-sin(latitude0))²
+ ((sin(longitude1)*cos(latitude1)-sin(longitude0)*cos(latitude0))²
+ ((cos(longitude1)*cos(latitude1)-cos(longitude0)*cos(latitude0))²
)/2)*circumfrence of earth/pi
0

Author Comment

I need to calculate it the other way round.

If the latitude value is 14.52 degrees, I need the latitude delta value within 50 miles of distance.

I know the result would be around ~0.01 degrees
0

LVL 25

Expert Comment

As ozo has said, there's an infinite number of possible solutions.

Imagine a point on the Earth. Now draw a circle around this point with a radius of "distance". The corresponding lat/long values that you're looking for could be _anywhere_ on the circumference of that circle.

And even if you specified one of the values (either lat OR long) for the point you're trying to find, it would still be ambiguous; as a circle is a many-to-many function, and you'll end up with 2 possible solutions.

0

LVL 84

Expert Comment

if everything always has the same longitude value, then 50 miles would be about .7228 degrees of latitude
(a little more near the equator, a little more near the poles)
0

Author Comment

latitude would always be same. 1 degree = 69.2 miles so latitudedelta = 1*50/69.2

But I need exact value for longitude, how can I figure out the exact difference as distance in 1 degree of longitude differs at equator and poles.
0

LVL 84

Expert Comment

Approcimating the earth as an ellipsoid http://kai.er.usgs.gov/ftp/PROJ.4/proj.html
0

LVL 84

Expert Comment

This formula for R gives but a rough approximation to the radius of curvature as a function of latitude. The radius of curvature varies with direction and latitude; according to Snyder ("Map Projections - A Working Manual", by John P. Snyder, U.S. Geological Survey Professional Paper 1395, United States Government Printing Office, Washington DC, 1987, p24), in the plane of the meridian it is given by

R' = a * (1 - e^2) / (1 - e^2 * sin^2(lat))^(3/2)

where a is the equatorial radius, b is the polar radius, and e is the eccentricity of the ellipsoid = (1 - b^2/a^2)^(1/2).
0

LVL 84

Expert Comment

But when you take into account the fact that the Earth is not quite a sphere, there are subtly different ways of defining "latitude", so you may need to ask a more precise question to get a more precise answer.
0

Author Comment

I have used haversine formula to calculate the distance

distance(lat1, long1, lat2, long2) = DOUBLE_EARTH_RADIUS *  atan2(sqrt
((sin((lat2-lat1)/2))^2 + cos(lat1) * cos(lat2) * (sin((lon2-lon1)/2)) ^2), sqrt(1-a))
0

## Featured Post

### Suggested Solutions

Purpose To explain how to place a textual stamp on a PDF document.  This is commonly referred to as an annotation, or possibly a watermark, but a watermark is generally different in that it is somewhat translucent.  Watermark’s may be text or graph…
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…