uwacan.positional.shift_position#
- shift_position(lat, lon, distance, bearing)[source]#
Shifts a position given by latitude and longitude by a certain distance and bearing.
The implementation is based on spherical trigonometry, with internal conversions to geocentric coordinates, and using the local radius of the earth. This is expressed as
\[\begin{split}φ_2 &= \arcsin(\sin(φ_1) ⋅ \cos(δ) + \cos(φ_1) ⋅ \sin(δ) ⋅ \cos(θ)) \\ λ_2 &= λ_1 + \arctan(\frac{\sin(θ) ⋅ \sin(δ) ⋅ \cos(φ_1)}{\cos(δ) - \sin(φ_1) ⋅ \sin(φ_2)})\end{split}\]where: φ is latitude, λ is longitude, θ is the bearing (clockwise from north), δ is the angular distance d/R; d being the distance traveled, R the earth’s radius.
- Parameters:
- latfloat
Latitude of the initial position in degrees.
- lonfloat
Longitude of the initial position in degrees.
- distancefloat
Distance to move from the initial position in meters.
- bearingfloat
Direction to move from the initial position in degrees.
- Returns:
- new_latfloat
Latitude of the new position in degrees.
- new_lonfloat
Longitude of the new position in degrees.