Search for points of interest around points or in geometries.
ors_pois(
request = c("pois", "stats", "list"),
geometry,
...,
api_key = ors_api_key(),
output = c("parsed", "text", "sf")
)
One of the following: "pois"
, "stats"
or "list"
named list containing either a geojson
geometry object
(GeoJSON Point, LineString or Polygon) or a bbox
, optionally buffered by
a value provided buffer
Optional request attributes as described here
Character scalar containing openrouteservice API key
Output format. By default the response is being parsed to a list-based R object
A list of points of interest in the area specified in 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. Valid only for argument request = "pois"
.
There are three different request types: pois
, stats
and list
.
pois
returns a GeoJSON FeatureCollection in the bounding box specified in
geometry$bbox
or a GeoJSON geometry provided in geometry$geojson
. stats
does the same but groups by categories, ultimately returning a JSON object
with the absolute numbers of POIs of a certain group.
list
returns a list of category groups and their ids.
# These examples might require interaction to query the local keyring, or
# might fail due to network issues, so they are not run by default
if (FALSE) { # \dontrun{
# POI categories list
ors_pois('list')
# POIs around a buffered point
geometry <- list(geojson = list(type = "Point",
coordinates = c(8.8034, 53.0756)),
buffer = 100)
ors_pois(geometry = geometry)
# alternative specification via bounding box
ors_pois(geometry = list(bbox = list(c(8.8034, 53.0756), c(8.8034, 53.0756)),
buffer = 100))
# POIs of given categories
ors_pois(geometry = geometry,
limit = 200,
sortby = "distance",
filters = list(
category_ids = c(180, 245)
))
# POIs of given category groups
ors_pois(geometry = geometry,
limit = 200,
sortby = "distance",
filters = list(
category_group_ids = 160
))
# POI Statistics
ors_pois("stats", geometry = geometry)
} # }