Use data from data.gouv.fr

[This article was first published on r.iresmi.net, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Day 6 of 30DayMapChallenge : « network » (previously).

Using GIS data directly from data.gouv.fr : railways network of France.

library(dplyr)
library(ggplot2)
library(sf)
library(glue)
library(httr)

# https://www.data.gouv.fr/fr/datasets/fichier-de-formes-des-voies-du-reseau-ferre-national/
GET("https://www.data.gouv.fr/fr/datasets/r/71e38477-1166-4074-a532-c51f3f399b09",
    write_disk("~/data.zip"))
unzip("~/data.zip")

network <- read_sf("~/fichier-de-formes-des-voies-du-reseau-ferre-national.shp") %>% 
  st_transform("EPSG:2154")

network %>% 
  ggplot() +
  geom_sf() +
  theme_minimal() +
  theme(plot.background = element_rect(fill = "white", color = NA)) +
  labs(title = "Réseau ferré français",
       caption = glue("données SNCF 2020 - data.gouv.fr
                      r.iresmi.net - {Sys.Date()}"))

ggsave("sncf.png", width = 20, height = 12.36, units = "cm", scale = 1.1)
Réseau ferré français
To leave a comment for the author, please follow the link and comment on their blog: r.iresmi.net.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)