esp_get_country {mapSpain} | R Documentation |
Get sf
POLYGON
representing Spain
Description
Returns the boundaries of Spain as a single sf
POLYGON
at a
specified scale.
Usage
esp_get_country(moveCAN = TRUE, ...)
Arguments
moveCAN |
A logical |
... |
Arguments passed on to
|
Value
A sf
POLYGON
object.
About caching
You can set your cache_dir
with esp_set_cache_dir()
.
Sometimes cached files may be corrupt. On that case, try re-downloading
the data setting update_cache = TRUE
.
If you experience any problem on download, try to download the
corresponding .geojson file by any other method and save it on your
cache_dir
. Use the option verbose = TRUE
for debugging the API query.
Displacing the Canary Islands
While moveCAN
is useful for visualization, it would alter the actual
geographic position of the Canary Islands. When using the output for
spatial analysis or using tiles (e.g. with esp_getTiles()
or
addProviderEspTiles()
) this option should be set to FALSE
in order to
get the actual coordinates, instead of the modified ones. See also
esp_move_can()
for displacing stand-alone sf
objects.
See Also
Other political:
esp_codelist
,
esp_get_can_box()
,
esp_get_capimun()
,
esp_get_ccaa()
,
esp_get_comarca()
,
esp_get_gridmap
,
esp_get_munic()
,
esp_get_nuts()
,
esp_get_prov()
,
esp_get_simpl_prov()
Examples
OriginalCan <- esp_get_country(moveCAN = FALSE)
# One row only
nrow(OriginalCan)
library(ggplot2)
ggplot(OriginalCan) +
geom_sf(fill = "grey70")
# Less resolution
MovedCan <- esp_get_country(moveCAN = TRUE, resolution = "20")
library(ggplot2)
ggplot(MovedCan) +
geom_sf(fill = "grey70")