Learn R Programming

TrackReconstruction (version 1.3)

CalcLongitude: Calculate Longitude

Description

Calculate the longitude of a destination given initial latitude and longitude, distance traveled, bearing and final latitude.

Usage

CalcLongitude(initialLat, destinationLat, initialLong, distance, bearing)

Arguments

initialLat

initial Latitude

destinationLat

final Latitude

initialLong

initial Longitude

distance

distance from initial to final in meters

bearing

bearing from point of departure to final destination

Value

Longitude of final destination in radians.

Details

Calculates a destination's longitude given initial latitude and longitude in degrees (e.g.162.546, Longitude values west of the prime meridian are 0 to -180. Latitude values south of the equator are 0 to -90), destination latitude in RADIANS (result of CalcLatitude function), distance traveled in meters and bearing in radians. This function is primarily used internally in the GPStable and GeoReference functions.

References

https://www.movable-type.co.uk/scripts/latlong.html

Examples

Run this code
# NOT RUN {
#Longitude of Los Angeles starting in Manhattan
Long <- CalcLongitude(40.7697,0.5943228,-73.9735,3938000,-1.507516)
#transform to degrees
Long*360/(2*pi)

##Use results of CalcLatitude
Lat<-CalcLatitude (40.7697,3938000,-1.507516)
Long <- CalcLongitude(40.7697,Lat,-73.9735,3938000,-1.507516)
#transform to degrees
Long*360/(2*pi)

# }

Run the code above in your browser using DataLab