Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

So, I have this nifty function:

latitudeDifference = endLatitude - startLatitude
longitudeDifference = endLongitude - startLongitude
RADIUS = 6367 (This is the radius of the earth)

angle = $\sin^2\left(\dfrac{latitudeDifference}{2}\right) + cos(startLatitude) * cos(endLatitude) * \sin^2\left(\dfrac{longitudeDifference}{2}\right) $

unitDistance = 2 * arctan$\left(\dfrac{\sqrt(angle)}{\sqrt(1.0f - angle)}\right) $

distance = RADIUS * unitDistance;

that helps me to figure out the distance between two points, given a startCoordinate and an endCoordinate. However, I am trying to utilize this function in order to calculate the latitude and longitude offsets given a distance (basically inverting the function for endLatitude and endLongitude), but when I found the functions, I couldn't escape i in many use cases, which says to me that the calculation must be invalid.

Is it possible to inverse this function to find a latitude or longitude offset for which is 'distance' away from the starting point?

Basically, if I have a coordinate (latitude : 50.0, longitude : 100.0) and I want to know the offset for both latitude and longitude (two separate equations) given a certain distance (50KM in this case), is it possible to reverse this function in order to give me a latitude offset (50KM away from (50.0, 100.0) using only latitude) and a longitude offset (50KM away from (50.0, 100.0) using only longitude)?

In even simpler terms, I have distance, but I want endLatitude and endLongitude by calculating them separately and assuming their counterpart is 0.


I want to find the distance in latitude and longitude. Essentially, I want to know the offset of latitude that is 50km away from the starting point and the longitude offset that is 50km from the starting point in terms of latitude.longitude (degrees and/or radians).

Maybe this image will help:

I want to find point A and point B in terms of Latitude and Longitude (Radians)

share|improve this question
I don't understand what your asking –  Ethan Dec 14 '12 at 22:34
Typically, the radius would only set one of the two variables (latitude or longitude). –  Fabian Dec 14 '12 at 22:37
@Ethan I've tried to make it a bit more understandable. –  RileyE Dec 14 '12 at 22:44
Whats a latitude and longitude radius? –  Ethan Dec 14 '12 at 22:50
@Ethan I'm not sure where you're getting the latitude and longitude radius from. The only RADIUS is the radius of the earth, which is part of determining the distance between the two points. –  RileyE Dec 14 '12 at 22:52
show 4 more comments

Your Answer


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

Browse other questions tagged or ask your own question.