| filter_gadm_province_spatial | R Documentation |
Filter a Spanish GADM layer using a strict province identity resolver.
filter_gadm_province_spatial(adm,
prov, province_table = NULL,
level = attr(adm,
"gadm_level",
exact = TRUE),
strict = TRUE)
adm |
An |
prov |
Province code or name. Numeric codes are matched directly.
Non-numeric names are resolved against a clean GADM-oriented
province-name lookup and, only as a last resort, against
basifoR's |
province_table |
Optional province lookup table used only by the fallback basifoR code resolver. It is not used as a list of GADM aliases. |
level |
GADM |
strict |
|
This function deliberately does not use all aliases stored in
procods for GADM filtering. The procods table can
contain operational curation and province redirections used by
basifoR/MITECO workflows. Boundary filtering needs geographic
province identity. Therefore procods is used, at most,
to resolve the input to a numeric province code; the final GADM
match uses exact normalized matching against NAME_2 and
a clean province-name lookup. This avoids false matches such as
Zamora also selecting Zaragoza through a short alias.
A filtered sf object. For GADM level 2, the object should
contain one province feature. For higher levels, the object may
contain several subprovince features. Attributes store the
resolved province code, GADM name, and aliases tested.
Exact normalized matching only. Do not use grepl() with short aliases.
Wilson Lara [aut, cre] (ORCID: <https://orcid.org/0000-0003-3527-1380>), Cristobal Ordonez [aut] (ORCID: <https://orcid.org/0000-0001-5354-3760>), Aitor Vázquez-Veloso [aut] (ORCID: <https://orcid.org/0000-0003-0227-506X>), Felipe Bravo [aut] (ORCID: <https://orcid.org/0000-0001-7348-6695>)
gadm_spatial, readNFI_spatial
if (interactive()) {
adm <- gadm_spatial("ESP", level = 2, path = tempdir())
zamora <- filter_gadm_province_spatial(adm, 49)
nrow(zamora)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.