| geo.tools | R Documentation |
Some functions for use with (latitude, longitude) coordinates.
geoFrame(lat, lon = NULL, ..., pair.lat.lon = TRUE)
geoBearing(lat, lon = NULL, ...)
geoDistance(lat, lon = NULL, units = "m", ...)
geoElevation(
lat,
lon = NULL,
units = "m",
...,
method = "google.elevation",
n = 10
)
geoDestination(
lat,
lon = NULL,
bearing = NULL,
distance = NULL,
units = "m",
...
)
geoConvertBNG2LatLon(east, north = NULL, ..., crs = 27700)
geoConvertLatLonDec2Deg(lat, lon = NULL, ..., format = NULL, test = FALSE)
lat, lon |
Latitudes and longitudes to be used in geographical calculations. Note: This can be supplied as two vectors or as a list or data.frame containing lat and lon vectors. |
... |
Additional arguments, currently ignored. |
pair.lat.lon |
(Logical) Should |
units |
(Character) The units that results should be reported in.
For, geoDistance, |
method |
(For |
n |
(For |
bearing, distance |
(For |
east, north |
(For |
crs |
(For |
format |
(For |
test |
(For |
geoFrame is data handler used by other geo...
functions. It returns a list containing the named components
lat and lon. if latitude, longitude pairing has
been applied pair.lat.lon = TRUE these components will
be the same length.
geoBearing returns a vector of bearings for supplied lat, lon
combinations. NOTE: Bearings length will be one less than the length
number of lat (or lon) because bearings are measured prior point to
latter point.
geoDistance returns a vector of distances between supplied lat,
lon points in a supplied series, so again one less the supplied number
of points. By default, this will be supplied in meters, but units can
be modified as part of the call using, e.g. units = "km" to get
distance(s) in kilometers.
geoElevation returns a vector of elevations, one for each
lat, lon pair supplied. By default, this will be supplied in meters,
but units can be modified as part of the call using, e.g.
units = "km" to get elevations(s) in kilometers.
geoDestination returns a list of named lat/lon pairs for
the path from the supplied lat/lon start point, assuming the
journey described by the supplied bearings and distance.
geoConvertBNG2LatLon converts British National
Grid (BNG) Easting/Northing coordinates to (WGS84)
Latitude/Longitude coordinates.
geoConvertLatLonDeg2Dem converts Latitude/Longitude coordinates
logged in degrees to decimal.
All functions currently require or convert to
lat and lon in WGS84 coordinates and
conventional decimal format.
geoBearing DETAILS NEEDED.
geoDistance uses the haversine formula to account to the
Earth's surface curvature, and uses 6371 km as the radius of earth.
geoElevation uses the Google elevation API to get elevations,
so required R to be internet enabled.
geoDestination DETAILS NEEDED.
Karl Ropkins
#example 1
lat <- 1:10
lon <- 1:10
#get the distance point1 to point2, point2 to point2, etc.
dist <- geoDistance(lat, lon)
#get the bearing point1 to point2, point2 to point2, etc.
bear <- geoBearing(lat, lon)
#reconstruct the journey from start point,
#using distances and bearings
geoDestination(lat[1], lon[1], bear, dist)
#(very nearly...)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.