newLonLat | R Documentation |
newLonLat
calculates a new lon/lat position given an sarting lon/lat
position, a bearing and a distance to the new lon/lat position.
Either the lon and lat arguments or the bearing and distance arguments can be a vector,
whereby a vector of new locations will be calculated.
newLonLat(lon, lat, bearing, distance)
lon |
Longitude 1 (in decimal degrees) |
lat |
Latitude 1 (in decimal degrees) |
bearing |
Longitude 2 (in decimal degrees) |
distance |
Distance to new lon/lat position (km) |
List of new lon/lat locations
# Single new lon/lat position calculation newLonLat(0,0,45,1000) # Vector of new lon/lat positions and plot startPos <- list(lon=0,lat=0) endPos <- newLonLat(startPos$lon, startPos$lat, seq(0,360,20), 1000) plot(1, t="n", xlim=range(endPos$lon), ylim=range(endPos$lat), xlab="lon", ylab="lat") segments(startPos$lon, startPos$lat, endPos$lon, endPos$lat, col=rainbow(length(endPos$lon))) points(startPos$lon, startPos$lat) points(endPos$lon, endPos$lat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.