Access Finnish Geospatial Data.
# install from CRAN
install.packages("geofi")
# Install development version from GitHub
::install_github("ropengov/geofi") remotes
With geofi
-package you can download geospatial data on
municipalities, zipcodes and population and statistical grids from
Statistics Finland WFS-api.
In addition, you have on-board municipality keys for aggregating
municipality-level data into higher level regional distributions based
Statistics Finland classification
API.
Below are few examples of the data you can access using
geofi
. Please have a closer look at the vignettes
for more comprehensive use cases.
library(geofi)
<- get_municipalities(year = 2023)
d1 <- get_zipcodes(year = 2023)
d2 <- get_statistical_grid(resolution = 5)
d3 <- get_population_grid(resolution = 5)
d4
library(ggplot2)
library(dplyr)
theme_set(
theme_minimal(base_family = "Arial") +
theme(legend.position= "none",
axis.text = element_blank(),
axis.title = element_blank(),
panel.grid = element_blank()
)
)<- ggplot(d1, aes(fill = kunta)) + geom_sf(colour = alpha("white", 1/3)) + labs(subtitle = "municipalities")
p1 <- ggplot(d1 %>% count(maakunta_code), aes(fill = maakunta_code)) + geom_sf(colour = alpha("white", 1/3)) + labs(subtitle = "Aggregated municipality data \nat region (maakunta) level \n(one of many!)")
p2 <- ggplot(d2, aes(fill = as.integer(posti_alue))) + geom_sf(colour = alpha("white", 1/3)) + labs(subtitle = "zipcodes")
p3 <- ggplot(d3, aes(fill = nro)) + geom_sf(colour = alpha("white", 1/3)) + labs(subtitle = "statistical grid")
p4 <- ggplot(d4, aes(fill = id_nro)) + geom_sf(colour = alpha("white", 1/3)) + labs(subtitle = "population grid")
p5 <- ggplot(municipality_central_localities, aes(color = as.integer(kuntatunnus))) + geom_sf() + labs(subtitle = "Central municipality localities")
p6
library(patchwork)
wrap_plots(list(p1,p2,p3,p4,p5,p6), ncol = 3) +
::plot_annotation(title = "Spatial data in geofi-package") patchwork
Contributions are very welcome:
Kindly cite this work as follows: Markus Kainu, Joona Lehtomäki, Juuso Parkkinen, Jani Miettinen, Pyry Kantanen, Leo Lahti Retrieval and analysis of open geospatial data from Finland with the geofi R package. R package version 1.0.15. URL: https://ropengov.github.io/geofi/
We are grateful to all contributors. This project is part of rOpenGov.