Description Usage Arguments Details Value Examples
This function returns the altitude (elevation) in meters for coordinates.
1 2 3 | get_altitude(.Data, .longitude = NULL, .latitude = NULL,
.src = c("racemap", "geonames", "google", "openelevation"),
.geonames.username = "demo", .google.api.key = NULL)
|
.Data |
data.table or data.frame with columns |
.longitude |
Numeric vector. |
.latitude |
Numeric vector. |
.src |
Character value. Which API service to use?
One of |
.geonames.username |
Character value. |
.google.api.key |
Character value. |
Currently different services can be used:
geonames
: Uses the geonames webservice. The number of free requests is limited,
for a higher rate, register and pass your username to this function.
Check usage terms at http://www.geonames.org/export/web-services.html.
google
: Uses the Google Elevation API.
You need to pass your API key. Costs can apply.
Check usage terms at
https://developers.google.com/maps/documentation/elevation/usage-and-billing.
openelevation
: Uses free Open-Elevation API.
See https://github.com/Jorl17/open-elevation.
racemap
: Uses free Racemap API. Based on mapzen terrain data.
See https://github.com/racemap/elevation-service.
It is recommended to use environment variables to pass secrets like your geonames username or API keys to the function.
Note that some APIs do not return values for ocean areas, e.g. at geonames those values are encoded as -32768.
Numeric vector of altitudes.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## Not run:
Data <- data.frame(latitude = 48:50, longitude = 11:13)
# Geonames
get_altitude(Data, .src = "geonames")
# Set your geonames username as environment variable in .Renviron file before.
# get_altitude(Data, .src = "geonames", .geonames.username = Sys.getenv("GEONAMES_USERNAME"))
# Google
# get_altitude(Data, Data, .src = "google", .google.api.key = Sys.getenv("GOOGLE_API_KEY"))
# Racemap
get_altitude(Data, .src = "racemap")
# Open-Elevation
get_altitude(Data, .src = "openelevation")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.