0
$\begingroup$

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.

EDIT

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)

  • 1
    I don't understand what your asking2012-12-14
  • 0
    Typically, the radius would only set one of the two variables (latitude or longitude).2012-12-14
  • 0
    @Ethan I've tried to make it a bit more understandable.2012-12-14
  • 0
    Whats a latitude and longitude radius?2012-12-14
  • 0
    @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.2012-12-14
  • 0
    "..utilize this function in order to calculate the latitude and longitude radiuses.. "2012-12-14
  • 0
    @Ethan Oops. In my head I was picturing a circle. I've edited them to "offset" instead.2012-12-14
  • 0
    You have a function of distance d, and its dependent on two varriables the start lattitude, sl and end lattitude dl, so we have d=f(sl,dl), your trying to invert a function of 1 varriable to output a function of two varriables, this isn't possible, youl need more then one function atleast.2012-12-14
  • 0
    let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/6738/discussion-between-rileye-and-ethan)2012-12-14

0 Answers 0