ohsome_parse {ohsome} | R Documentation |
Parse content from an ohsome API response
Description
Extracts and parses the content from an ohsome API response
Usage
ohsome_parse(
response,
returnclass = c("default", "sf", "data.frame", "list", "character"),
omit_empty = TRUE
)
ohsome_sf(response, omit_empty = TRUE)
ohsome_df(response, omit_empty = TRUE)
Arguments
response |
An |
returnclass |
character; one of the following:
|
omit_empty |
logical; omit features with empty geometries (only if
|
Details
ohsome_parse()
parses an ohsome_response
object into an object of the
specified class. By default, this is an sf
object if the ohsome API
response contains GeoJSON data or a data.frame
if it does not.
ohsome_sf()
and ohsome_df()
wrapper functions for specific return
classes.
Value
An sf
object, a data.frame
, a list
or a character
Examples
## Not run:
# Create and send a query to ohsome API
r <- ohsome_query("elements/centroid", filter = "amenity=*") |>
set_boundary(osmdata::getbb("Heidelberg")) |>
set_time("2021") |>
set_properties("metadata") |>
ohsome_post(parse = FALSE)
# Parse response to object of default class (here: sf)
ohsome_parse(r)
# Parse response to data.frame
ohsome_df(r)
# Parse response to sf
ohsome_sf(r)
## End(Not run)