ohsome_post {ohsome}R Documentation

Send POST request to ohsome API

Description

Sends an ohsome_query object as a POST request to the ohsome API and returns the response.

Usage

ohsome_post(
  query,
  parse = TRUE,
  validate = TRUE,
  strict = validate,
  additional_identifiers = NULL,
  ...
)

Arguments

query

An ohsome_query object constructed with ohsome_query() or any of its wrapper functions

parse

logical; if TRUE, parse the ohsome API response with ohsome_parse()

validate

logical; if TRUE, issues warning for invalid endpoint or invalid/missing query parameters.

strict

logical; If TRUE, throws error on invalid query. Overrules validate argument TRUE.

additional_identifiers

vector coercible to character; optional user agent identifiers in addition to "ohsome-r/{version}".

...

Additional arguments passed to ohsome_parse():

  • returnclass: class of the returned object

  • omit_empty: logical; omit features with empty geometries (only if returnclass = "sf")

Value

An ohsome_response object if parse = FALSE, else an sf object, a data.frame, a list or a character

See Also

ohsome API documentation

Examples

## Not run: 
# Get bounding box of the city of Berlin
bbberlin <- osmdata::getbb("Berlin")

# Query for cinema geometries within bounding box
q <- ohsome_elements_geometry(bbberlin, filter = "amenity=cinema")

# Send query to ohsome API and return sf by default
ohsome_post(q)

# Send query to ohsome API and return data.frame
ohsome_post(q, returnclass = "data.frame")

# Send query and return unparsed response
ohsome_post(q, parse = FALSE)

## End(Not run)


[Package ohsome version 0.2.2 Index]