View source: R/set_parameters.R
set_parameters | R Documentation |
Sets or modifies parameters of an existing ohsome_query
object
set_parameters(query, ...)
set_time(query, time = query$body$time)
set_filter(query, filter = query$body$filter, filter2 = query$body$filter2)
set_groupByKeys(query, groupByKeys = query$body$groupByKeys)
set_groupByKey(query, groupByKey = query$body$groupByKey)
set_groupByValues(query, groupByValues = query$body$groupByValues)
set_properties(query, properties = NULL)
query |
An |
... |
Parameters of the request to the ohsome API endpoint. |
time |
character; |
filter |
character; |
filter2 |
character; |
groupByKeys |
character; |
groupByKey |
character; |
groupByValues |
character; |
properties |
character; properties to be extracted with extraction queries:
Multiple values can be provided as comma-separated character or as
character vector. This defaults to |
set_parameters()
takes an ohsome_query
object and an arbitrary number of
named parameters as an input. It sets or modifies these parameters in the
ohsome_query
and returns the modified object. set_time()
, set_filter()
,
set_groupByKeys()
, set_groupByKey()
, set_groupByValues()
and
set_properties()
are wrapper functions to set specific parameters. By
default, an unmodified ohsome_query
object is returned. In order to remove
a parameter from the query object, you can set the respective argument
explicitly to NULL
(e.g. set_filter(query, filter = NULL)
).
An ohsome_query
object. The object can be sent to the ohsome API
with ohsome_post()
. It consists of the following elements:
url
: The URL of the endpoint.
encode
: The way the information is encoded and then posted to the
ohsome API. Set as "form"
.
body
: The parameters of the query such as format
, filter
or
bpolys
.
https://docs.ohsome.org/ohsome-api/v1/
# Query ratio grouped by boundary
q1 <- ohsome_query(
endpoint = "elements/count/ratio/groupBy/boundary",
boundary = "HD:8.5992,49.3567,8.7499,49.4371|HN:9.1638,49.113,9.2672,49.1766"
)
# Add time, filter and format parameters
q1 |>
set_time("2021/2022/P3M") |>
set_filter("building=*", filter2 = "building=* and building:levels=3") |>
set_parameters(format = "csv")
# Query elements area grouped by tag
q2 <- ohsome_query(
endpoint = "elements/area/groupBy/tag",
boundary = "HD:8.5992,49.3567,8.7499,49.4371"
)
# Add time, filter and groupByKey parameters
q2 |>
set_time("2021/2022/P3M") |>
set_filter("building=*") |>
set_groupByKey("building:levels")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.