| get_wfs | R Documentation |
Download features from the IGN Web Feature Service (WFS) using a spatial predicate, an ECQL attribute query, or both.
get_wfs(
x = NULL,
layer = NULL,
predicate = bbox(),
query = NULL,
verbose = TRUE
)
x |
|
layer |
|
predicate |
|
query |
|
verbose |
|
get_wfs use ECQL language : a query language created by the
OpenGeospatial Consortium. More info about ECQL language can be
found here.
An object of class sf.
get_layers_metadata()
## Not run:
library(sf)
# Load a geometry
x <- read_sf(system.file("extdata/penmarch.shp", package = "happign"))
# Retrieve commune boundaries intersecting x
commune <- get_wfs(
x = x,
layer = "LIMITES_ADMINISTRATIVES_EXPRESS.LATEST:commune"
)
plot(st_geometry(commune), border = "firebrick")
# Attribute-only query (no spatial filter)
# If unknown, available attributes can be retrieved using `get_wfs_attributes()`
attrs <- get_wfs_attributes("LIMITES_ADMINISTRATIVES_EXPRESS.LATEST:commune")
print(attrs)
plou_communes <- get_wfs(
x = NULL,
layer = "LIMITES_ADMINISTRATIVES_EXPRESS.LATEST:commune",
query = "nom_officiel ILIKE 'PLOU%'"
)
plot(st_geometry(plou_communes))
# Multiple Attribute-only query (no spatial filter)
plou_inf_2000 <- get_wfs(
x = NULL,
layer = "LIMITES_ADMINISTRATIVES_EXPRESS.LATEST:commune",
query = "nom_officiel ILIKE 'PLOU%' AND population < 2000"
)
plot(st_geometry(plou_communes))
plot(st_geometry(plou_inf_2000), col = "firebrick", add = TRUE)
# Spatial predicate usage
layer <- "BDCARTO_V5:rond_point"
bbox_feat <- get_wfs(commune, layer, predicate = bbox())
plot(st_geometry(bbox_feat), col = "red")
plot(st_geometry(commune), add = TRUE)
intersects_feat <- get_wfs(commune, layer, predicate = intersects())
plot(st_geometry(intersects_feat), col = "red")
plot(st_geometry(commune), add = TRUE)
dwithin_feat <- get_wfs(commune, layer, predicate = dwithin(5, "kilometers"))
plot(st_geometry(dwithin_feat), col = "red")
plot(st_geometry(commune), add = TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.