esp_get_hydrobasin {mapSpain} | R Documentation |
Get sf
POLYGON
of the drainage basin demarcations of Spain
Description
Loads a sf
POLYGON
object containing areas with the required
hydrographic elements of Spain.
Usage
esp_get_hydrobasin(
epsg = "4258",
cache = TRUE,
update_cache = FALSE,
cache_dir = NULL,
verbose = FALSE,
resolution = "3",
domain = "land"
)
Arguments
epsg |
projection of the map: 4-digit EPSG code. One of:
|
cache |
A logical whether to do caching. Default is |
update_cache |
A logical whether to update cache. Default is |
cache_dir |
A path to a cache directory. See About caching. |
verbose |
Logical, displays information. Useful for debugging,
default is |
resolution |
Resolution of the |
domain |
Possible values are |
Details
Metadata available on https://github.com/rOpenSpain/mapSpain/tree/sianedata/.
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.
Source
IGN data via a custom CDN (see https://github.com/rOpenSpain/mapSpain/tree/sianedata).
See Also
Other natural:
esp_get_hypsobath()
,
esp_get_rivers()
Examples
hydroland <- esp_get_hydrobasin(domain = "land")
hydrolandsea <- esp_get_hydrobasin(domain = "landsea")
library(ggplot2)
ggplot(hydroland) +
geom_sf(data = hydrolandsea, fill = "skyblue4", alpha = .4) +
geom_sf(fill = "skyblue", alpha = .5) +
geom_sf_text(aes(label = rotulo),
size = 3, check_overlap = TRUE,
fontface = "bold",
family = "serif"
) +
coord_sf(
xlim = c(-9.5, 4.5),
ylim = c(35, 44)
) +
theme_void()