Extract nodes and railways of mainland Spain and the Balearic Islands.

esp_get_railway(
  year = Sys.Date(),
  epsg = "4258",
  cache = TRUE,
  update_cache = FALSE,
  cache_dir = NULL,
  verbose = FALSE,
  spatialtype = "line"
)

Arguments

year

Release year.

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.

spatialtype

Spatial type of the output. Use "line" for extracting the railway and "point" for the stations.

Source

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

Value

A MULTILINESTRING or POINT object.

Details

Details on caching can be found on esp_get_nuts()

See also

Author

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

Examples

# \donttest{ provs <- esp_get_prov() ccaa <- esp_get_ccaa() # Railways rails <- esp_get_railway() # Stations stations <- esp_get_railway(spatialtype = "point") # Map library(tmap) tm_shape(provs, bbox = c(-7.5, 38, -2.5, 41)) + tm_polygons(col = "grey90", border.col = "grey50") + tm_shape(ccaa) + tm_borders("black") + tm_shape(rails) + tm_lines("tipo", legend.col.show = FALSE, lwd = 2, palette = "Dark2" ) + tm_shape(stations) + tm_symbols("red", size = .3)
# }