set_parameters {ohsome}R Documentation

Set parameters

Description

Sets or modifies parameters of an existing ohsome_query object

Usage

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)

Arguments

query

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

...

Parameters of the request to the ohsome API endpoint.

time

character; time parameter of the query (see Supported time formats).

filter

character; filter parameter of the query (see Filter)

filter2

character; filter2 parameter of a ratio query

groupByKeys

character; groupByKeys parameter of a groupBy/key query

groupByKey

character; groupByKey parameter of a groupBy/tag query

groupByValues

character; groupByValues parameter of a groupBy/tag query

properties

character; properties to be extracted with extraction queries:

  • "tags", and/or

  • "metadata" (i.e. ⁠@changesetId⁠, ⁠@lastEdit⁠, ⁠@osmType⁠, ⁠@version⁠), and/or

  • "contributionTypes" (i.e. ⁠@creation⁠, ⁠@tagChange⁠, ⁠@deletion⁠, and ⁠@geometryChange⁠; only for contributions extraction)

Multiple values can be provided as comma-separated character or as character vector. This defaults to NULL (removes properties parameter from the query body).

Details

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

Value

An ohsome_query object. The object can be sent to the ohsome API with ohsome_post(). It consists of the following elements:

See Also

https://docs.ohsome.org/ohsome-api/v1/

Examples

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


[Package ohsome version 0.2.2 Index]