Loads a simple feature (sf) object containing areas with the required hydrograpic elements of Spain.

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:

  • "4258": ETRS89

  • "4326": WGS84

  • "3035": ETRS89 / ETRS-LAEA

  • "3857": Pseudo-Mercator

cache

A logical whether to do caching. Default is TRUE.

update_cache

A logical whether to update cache. Default is FALSE. When set to TRUE it would force a fresh download of the source .geojson file.

cache_dir

A path to a cache directory. The directory can also be set globally with:

See Details on esp_get_nuts().

verbose

Display information. Useful for debugging, default is FALSE.

resolution

Resolution of the polygon. Values available are "3", "6.5" or "10".

domain

Possible values are "land", that includes only the ground part or the ground or "landsea", that includes both the ground and the related sea waters of the basin

Source

IGN data via a custom CDN (see https://github.com/rOpenSpain/mapSpain/tree/sianedata.

Value

A POLYGON object.

Details

Metadata available on https://github.com/rOpenSpain/mapSpain/tree/sianedata/.

Author

dieghernan, https://github.com/dieghernan/

Examples

# \donttest{ all <- esp_get_prov(moveCAN = FALSE) hydroland <- esp_get_hydrobasin(domain = "land") hydrolandsea <- esp_get_hydrobasin(domain = "landsea") library(tmap) tm_shape(hydrolandsea, bbox = c(-9.5, 35, 4.5, 44)) + tm_fill("skyblue3") + tm_shape(all) + tm_polygons("grey90") + tm_shape(hydroland) + tm_polygons("skyblue", alpha = 0.7, border.col = "blue") + tm_layout(bg.color = "grey90")
# }