-
Notifications
You must be signed in to change notification settings - Fork 6
/
README.Rmd
executable file
·95 lines (69 loc) · 4.71 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
---
output: github_document
---
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/"
)
```
<!-- badges: start -->
[![rOG-badge](https://ropengov.github.io/rogtemplate/reference/figures/ropengov-badge.svg)](https://ropengov.org/)
[![R build status](https://github.com/rOpenGov/geofi//workflows/R-CMD-check/badge.svg)](https://github.com/rOpenGov/geofi/actions/)
[![Project Status: Active - The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/)
[![codecov](https://codecov.io/gh/rOpenGov/geofi/branch/master/graph/badge.svg?token=yJSHHMSSKs)](https://app.codecov.io/gh/rOpenGov/geofi)
[![Watch on GitHub](https://img.shields.io/github/watchers/ropengov/geofi.svg?style=social)](https://github.com/ropengov/geofi/watchers/)
[![Star on GitHub](https://img.shields.io/github/stars/ropengov/geofi.svg?style=social)](https://github.com/ropengov/geofi/stargazers/)
[![CRAN published](https://www.r-pkg.org/badges/version/geofi)](https://www.r-pkg.org/pkg/geofi)
[![Downloads](http://cranlogs.r-pkg.org/badges/grand-total/geofi)](https://cran.r-project.org/package=geofi)
[![Downloads](http://cranlogs.r-pkg.org/badges/geofi)](https://cran.r-project.org/package=geofi)
<!-- badges: end -->
# geofi - Access Finnish Geospatial Data <a href='https://ropengov.github.io/geofi/'><img src='man/figures/logo.png' align="right" height="139" /></a>
<!-- README.md is generated from README.Rmd. Please edit that file -->
Access Finnish Geospatial Data.
## Installation and use
```{r, eval = FALSE, message = FALSE, warning = FALSE}
# install from CRAN
install.packages("geofi")
# Install development version from GitHub
remotes::install_github("ropengov/geofi")
```
With `geofi`-package you can download geospatial data on municipalities, zipcodes and population and statistical grids from Statistics Finland [WFS-api](https://stat.fi/org/avoindata/paikkatietoaineistot_en.html). In addition, you have on-board municipality keys for aggregating municipality-level data into higher level regional distributions based Statistics Finland [classification API](https://data.stat.fi/api/classifications/v2/).
Below are few examples of the data you can access using `geofi`. Please have a closer look at the [vignettes](https://ropengov.github.io/geofi/articles/index.html) for more comprehensive use cases.
```{r readme_map, message = FALSE, warning = FALSE, fig.height=10}
library(geofi)
d1 <- get_municipalities(year = 2023)
d2 <- get_zipcodes(year = 2023)
d3 <- get_statistical_grid(resolution = 5)
d4 <- get_population_grid(resolution = 5)
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()
)
)
p1 <- ggplot(d1, aes(fill = kunta)) + geom_sf(colour = alpha("white", 1/3)) + labs(subtitle = "municipalities")
p2 <- 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!)")
p3 <- ggplot(d2, aes(fill = as.integer(posti_alue))) + geom_sf(colour = alpha("white", 1/3)) + labs(subtitle = "zipcodes")
p4 <- ggplot(d3, aes(fill = nro)) + geom_sf(colour = alpha("white", 1/3)) + labs(subtitle = "statistical grid")
p5 <- ggplot(d4, aes(fill = id_nro)) + geom_sf(colour = alpha("white", 1/3)) + labs(subtitle = "population grid")
p6 <- ggplot(municipality_central_localities, aes(color = as.integer(kuntatunnus))) + geom_sf() + labs(subtitle = "Central municipality localities")
library(patchwork)
wrap_plots(list(p1,p2,p3,p4,p5,p6), ncol = 3) +
patchwork::plot_annotation(title = "Spatial data in geofi-package")
```
### Contribute
Contributions are very welcome:
* [Use issue tracker](https://github.com/ropengov/geofi/issues) for feedback and bug reports.
* [Send pull requests](https://github.com/ropengov/geofi/)
* [Star us on the Github page](https://github.com/ropengov/geofi/)
### Acknowledgements
**Kindly cite this work** as follows:
[Markus Kainu](https://github.com/muuankarski), [Joona Lehtomäki](https://github.com/jlehtoma), Juuso Parkkinen, Jani Miettinen, Pyry Kantanen, [Leo Lahti](https://github.com/antagomir)
Retrieval and analysis of open geospatial data from Finland with the geofi R package. R package version `r sessionInfo()$otherPkgs$geofi$Version`. URL: [https://ropengov.github.io/geofi/](https://ropengov.github.io/geofi/)
We are grateful to all [contributors](https://github.com/rOpenGov/geofi/graphs/contributors). This project is part of [rOpenGov](https://ropengov.org).