-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME.Rmd
184 lines (136 loc) · 4.31 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
# geoDK
The goal of geoDK is to make it easy to use danish GIS data in R.
## Installation
You can install geoDK from github with:
```{r gh-installation, eval = FALSE}
# install.packages("devtools")
devtools::install_github("mikkelkrogsholm/geoDK")
```
## Polygons
geoDK contains polygon data for a range of danish administrative areas. It has data for:
* parishes
* zip codes
* municipalities
* regions
* police districts
* jurisdictions
* constituencies
Let me show you a few examples.
#### First load packages
```{r example1_load, eval = FALSE}
library(geoDK)
library(ggplot2)
library(ggthemes)
```
#### Plot regions
```{r regions, eval = FALSE}
dk_regions <- geo_get_spatial("Danish regions")
df_regions <- make_tidy_poly(dk_regions)
ggplot(df_regions) +
geom_polygon(aes(x = lng, y = lat, group = area, fill = regionkode),
color = "black", show.legend = FALSE) +
coord_cartesian() +
theme_map()
```
#### Plot municipalities
```{r municipalities, eval = FALSE}
dk_municipalities <- geo_get_spatial("Danish municipalities")
df_municipalities <- make_tidy_poly(dk_municipalities)
ggplot(df_municipalities) +
geom_polygon(aes(x = lng, y = lat, group = area, fill = komkode),
color = "black", show.legend = FALSE) +
coord_cartesian() +
theme_map()
```
#### Plot police districts
```{r police_districts, eval = FALSE}
dk_police_districts <- geo_get_spatial("Danish police districts")
df_police_districts <- make_tidy_poly(dk_police_districts)
ggplot(df_police_districts) +
geom_polygon(aes(x = lng, y = lat, group = area, fill = polkr_nr),
color = "black", show.legend = FALSE) +
coord_cartesian() +
theme_map()
```
#### Plot zip codes
```{r zip_codes, eval = FALSE}
dk_zip_codes <- geo_get_spatial("Danish zip codes")
df_zip_codes <- make_tidy_poly(dk_zip_codes)
ggplot(df_zip_codes) +
geom_polygon(aes(x = lng, y = lat, group = area, fill = postnr_txt),
color = "black", show.legend = FALSE) +
coord_cartesian() +
theme_map()
```
#### Plot parishes
```{r parishes, eval = FALSE}
dk_parishes <- geo_get_spatial("Danish parishes")
df_parishes <- make_tidy_poly(dk_parishes)
ggplot(df_parishes) +
geom_polygon(aes(x = lng, y = lat, group = area, fill = sognekode),
color = "black", show.legend = FALSE) +
coord_cartesian() +
theme_map()
```
#### Plot jurisdictions
```{r jurisdictions, eval = FALSE}
dk_jurisdictions <- geo_get_spatial("Danish jurisdictions")
df_jurisdictions <- make_tidy_poly(dk_jurisdictions)
ggplot(df_jurisdictions) +
geom_polygon(aes(x = lng, y = lat, group = area, fill = retskrnr),
color = "black", show.legend = FALSE) +
coord_cartesian() +
theme_map()
```
#### Plot constituencies
```{r constituencies, eval = FALSE}
dk_constituencies <- geo_get_spatial("Danish constituencies")
df_constituencies <- make_tidy_poly(dk_constituencies)
ggplot(df_constituencies) +
geom_polygon(aes(x = lng, y = lat, group = area, fill = storkrnr), show.legend = FALSE) +
coord_cartesian() +
theme_map()
```
## Place names
geoDK contains spatial data for a range of danish place names It has data for:
* areas
* lines
* points
Let me show you a few examples.
#### Plot area
```{r areas, eval = FALSE}
placename_area <- geo_get_spatial("Danish placenames - areas")
# Pick only islands
placename_area_sub <- subset(placename_area, placename_area$feat_type == "ø")
placename_area_sub_df <- make_tidy_poly(placename_area_sub)
ggplot(placename_area_sub_df) +
geom_polygon(aes(x = lng, y = lat, group = area), show.legend = FALSE,
fill = "black") +
coord_cartesian() +
theme_map()
```
#### Plot lines
```{r lines, eval = FALSE}
placename_lines <- geo_get_spatial("Danish placenames - lines")
# Pick only water streams
placename_lines_sub <- subset(placename_lines, placename_lines$feat_type == "vandløb")
plot(placename_lines_sub)
```
#### Plot points
```{r points, eval = FALSE}
placename_points <- geo_get_spatial("Danish placenames - points")
# Pick only passage graves
placename_points_sub <- subset(placename_points, placename_points$feat_type == "jættestue")
plot(placename_lines_sub)
```