oe_get_boundary | R Documentation |
This function can be used to obtain polygon/multipolygon objects representing
an administrative boundary. The objects are extracted from the
multipolygons
layer of a given OSM extract.
oe_get_boundary(place, name = place, exact = TRUE, ...)
place |
Description of the geographical area that should be matched with
a |
name |
A character vector of length 1 that describes the relevant area.
By default, this is equal to |
exact |
Boolean of length 1. If |
... |
Further arguments (e.g. |
The function may return an empty result when the corresponding GPKG file
already exists and contains partial results. In that case, you can try
running the function setting never_skip_vectortranslate = TRUE
.
An sf
object
## Not run:
library(sf)
my_cols = sf.colors(5, categorical = TRUE)
gabon = oe_get_boundary("Gabon", quiet = TRUE) # country
libreville = oe_get_boundary("Gabon", "Libreville", quiet = TRUE) # capital
opar = par(mar = rep(0, 4))
plot(st_geometry(st_boundary(gabon)), reset = FALSE, col = "grey")
plot(st_geometry(libreville), add = TRUE, col = my_cols[1])
# Exact match
komo = oe_get_boundary("Gabon", "Komo", quiet = TRUE)
# Pattern matching
komo_pt = oe_get_boundary("Gabon", "Komo", exact = FALSE, quiet = TRUE)
plot(st_geometry(komo), add = TRUE, col = my_cols[2])
plot(st_geometry(komo_pt), add = TRUE, col = my_cols[3:5])
par(opar)
# Get all boundaries
(oe_get_boundary("Gabon", name = "%", exact = FALSE, quiet = TRUE)[, 1:2])
# If the basic approach doesn't work, i.e.
oe_get_boundary("Leeds")
# try to consider larger regions, i.e.
oe_get_boundary("West Yorkshire", "Leeds")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.