set_boundary | R Documentation |
Set or modify the spatial filter of an existing ohsome_query
object
set_boundary(query, boundary = NULL, ...)
query |
An |
boundary |
Bounding geometries specified by WGS84 coordinates in the
order
|
... |
Additional arguments other than |
set_boundary()
adds a spatial filter to an ohsome_query
object or
replaces an existing one. The spatial filter of a query to the ohsome API can
be defined as one or more polygons, bounding boxes or bounding circles.
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
.
# Query without boundary definition
q <- ohsome_query(
"elements/count/groupBy/boundary",
filter = "building=*",
time = "2022-01-01"
)
# Use franconia from the mapview package as bounding polygons
set_boundary(q, mapview::franconia, digits = 4)
# Use the bounding box of franconia
set_boundary(q, sf::st_bbox(mapview::franconia))
## Not run:
# Get bounding box of the city of Kigali from OSM
set_boundary(q, osmdata::getbb("Kigali"))
## End(Not run)
# Definition of two named bounding circles
set_boundary(q, c("Circle 1:8.6528,49.3683,1000", "Circle 2:8.7294,49.4376,1000"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.