ors_elevation: Openrouteservice Elevation

View source: R/elevation.R

ors_elevationR Documentation

Openrouteservice Elevation

Description

Get elevation data for points or lines

Usage

ors_elevation(
  format_in = c("geojson", "point", "polyline", "encodedpolyline", "encodedpolyline6"),
  geometry,
  format_out = format_in,
  ...,
  api_key = ors_api_key(),
  output = c("parsed", "text", "sf")
)

Arguments

format_in

input format

geometry

⁠longitude, latitude⁠ coordinate pairs

format_out

output format

...

Optional parameters as described here

api_key

Character scalar containing openrouteservice API key

output

Output format. By default the response is being parsed to a list-based R object

Details

A GeoJSON based service to query SRTM elevation for Point or LineString 2D geometries and return 3D geometries in various formats.

Value

3D point or line geometry structured according to output:

  • for "text", a character vector of length 1 re-encoded to UTF-8.

  • for "parsed", a parsed R object.

  • for "sf", a simple features sf object.

Author(s)

Andrzej Oleś andrzej.oles@gmail.com

Examples

# point coordinates
coordinates <- c(13.349762, 38.11295)
ors_elevation("point", coordinates)

# geojson as input
point <- '{ "type": "Point", "coordinates": [13.349762, 38.11295] }'
ors_elevation("geojson", point)

# line geometry returned as encoded polyline
coordinates <- list(
  c(13.349762, 38.11295),
  c(12.638397, 37.645772)
)
ors_elevation("polyline", coordinates, format_out = "encodedpolyline")

openrouteservice documentation built on Oct. 21, 2024, 9:06 a.m.