[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 700
  • Last Modified:

How to calculate the latitude from distance

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?
1 Solution
This should get you started with your assignment...


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.
 + ((sin(longitude1)*cos(latitude1)-sin(longitude0)*cos(latitude0))²
 + ((cos(longitude1)*cos(latitude1)-cos(longitude0)*cos(latitude0))²
)/2)*circumfrence of earth/pi
deeptinayakAuthor Commented:
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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.

You need to have some more info.
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)
deeptinayakAuthor Commented:
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.
Approcimating the earth as an ellipsoid http://kai.er.usgs.gov/ftp/PROJ.4/proj.html
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).
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.
deeptinayakAuthor Commented:
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))

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now