[GIS] Calculating a point Lat/Lon from another Lat/Lon point angle

algorithmgpsspherical-geometry

I need to make an algorithm:

enter image description here:

I have a point O center of a circle of radius r, on this circle there is two point P1 and P2.

  • I know latitude and longitude of point O in degrees
  • I know the radius r in meters
  • I know the latitude and longitude of P1 in degrees

I want to know the latitude and longitude of point P2 on the same circle, I know the angle a in degrees between the line OP1 and OP2.

How to solve this problem?

The gps points O,P1 and P2 are situated in the south of France.

Best Answer

Point P1 is irrelevant, if it's a circle r will always be the same, this together with the bearing theta and the origin point O are what matters. To find theta, simply trig your way from your provided angle a.

  1. Supposing your surface is a sphere:

    δ = distance r / Earth radius (both in the same units)
    
    lat_P2 = asin(sin lat_O ⋅ cos δ + cos lat_O ⋅ sin δ ⋅ cos θ )
    lon_P2 = lon_O + atan((sin θ ⋅ sin δ ⋅ cos lat_O) / (cos δ − sin lat_O ⋅ sin lat_P2))
    

    In the above formula, lat, lon and theta are to be provided in radians. Theta is, as in your example, the bearing clockwise from the North. Use absolute values if you coordinates are negative.

    This is an adaptation of the Haversine equation, if you want to look it up. It'll be as precise as the Earth radius you choose.

  2. Supposing your surface is an elipsoid:

    Ok, this is way more complicated, so I'll just link you to Vincenty's formula. You want to use the Direct Formula to find your P2. The same precautions apply here, concerning negative coordinates.