ors_pois: Openrouteservice POIs

View source: R/pois.R

ors_poisR Documentation

Openrouteservice POIs

Description

Search for points of interest around points or in geometries.

Usage

ors_pois(
  request = c("pois", "stats", "list"),
  geometry,
  ...,
  api_key = ors_api_key(),
  output = c("parsed", "text", "sf")
)

Arguments

request

One of the following: "pois", "stats" or "list"

geometry

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

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

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.

Value

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".

Author(s)

Andrzej Oleś andrzej.oles@gmail.com

Examples

# 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)

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