# NOT RUN {
provs <- esp_get_prov()
ccaa <- esp_get_ccaa()
# Railways
rails <- esp_get_railway()
# Stations
stations <- esp_get_railway(spatialtype = "point")
# Map
library(ggplot2)
ggplot(provs) +
geom_sf(fill = "grey99", color = "grey50") +
geom_sf(data = ccaa, fill = NA) +
geom_sf(
data = rails, aes(color = tipo),
show.legend = FALSE, lwd = 1.5
) +
geom_sf(
data = stations,
color = "red", alpha = 0.5
) +
coord_sf(
xlim = c(-7.5, -2.5),
ylim = c(38, 41)
) +
scale_color_manual(values = hcl.colors(
length(unique(rails$tipo)), "viridis"
)) +
theme_minimal()
# }
Run the code above in your browser using DataLab