Retrieves objects in the given boundary box either with or without geometry. May also fetch just the metadata.
Usage
wm_get_from_bbox(
x,
page = 1,
n_per_page = 100,
language = "en",
category = NULL,
get_location = TRUE,
wm_api_key = getOption("wikimapia_api_key", default = "example"),
meta_only = FALSE
)
Arguments
- x
a numeric vector of length 4, with xmin, ymin, xmax and ymax values; or a `bbox` object that is an output of st_bbox. The values must be in WGS 84 (EPSG 4326)
- page
This is page number. 1 is default. There are usually more objects in a bounding box than the limit of 100 objects per page. Therefore you need to specify page other than 1 to get other objects. The returned list object contains number of found features and the required number of pages to retrieve them all.
- n_per_page
This is a variable that determines the number of results per page. 100 is default (5 min, 100 max). This is `count` parameter in Wikimapia terminilogy, but different name is used here so that it does not conflict with the `dplyr::count()` function.
- language
Wikimapia language to retrieve. This is specified language in ISO 639-1 format. Default language is 'en'.
- category
This is wikimapia category code: category=17 - Shop, category=203 - School etc. (a detailed list will be published later) or category text query in UTF-8: category=School, category=Church etc. Default is NULL to get all categories.
- get_location
Specifies whether to get location (centroid) and polygon geometry. You may want to disable it if you are only using the wm_get_from_bbox to estimate the number of objects to reduce the returned object size.
- wm_api_key
Your wikimapia API Key. If not specified, the default 'example' key is used, however it is limited to about 1 request per 30 seconds and is for testing purposes only.
- meta_only
only return metadata from the response, do not return feature attributes or geometry.
Value
If `meta_only = FALSE` returns a list with data.frame of object attributes (and object geometry if `get_location = TRUE`). If `meta_only = TRUE` only returns metadata of the responce: the number of objects in the bounding box (`found`), version, language, current page, current `n_per_page`. If `get_location = TRUE` returns a list object with `sf polygons` with all object attributes, `sf points` with all object attributes (the centroids), and also the metadata described above.