-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (68 loc) · 2.86 KB
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
---
title: "Kantonaler Richtplan"
author: "OGD-Koordinationsstelle Kanton Thurgau"
date: "`r Sys.Date()`"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Open Government Data, provided by **Canton Thurgau**
*Autogenerated R starter code for geo-dataset with the identifier* **kantonaler-richtplan**
# **Kantonaler Richtplan**
[Link to dataset on data.tg.ch](https://data.tg.ch/explore/dataset/kantonaler-richtplan/information/)
## Description
Kantonaler Richtplan Thurgau 1:50'000 Hauptkarte und 1:200'000 Übersichtskarten; Enthalten die Themenbereiche Siedlung, Landschaft, Verkehr, Versorgung und Entsorgung und Weitere Raumnutzungen.
## Metadata
- **Issued** :
- **Modified** : 2022-11-09 00:00:00
- **Rights** : CC By 4.0
- **Keywords** : geodaten, entwicklungsplanung, raumplanung
## Load Packages
Every dataset (csv and geodata) on [data.tg.ch](https://data.tg.ch/pages/start/) can be retrieved with the **tgAPI** package. You can download it via [GitHub](https://github.com/ogdtg/tgAPI). Our Geodata rely on WFS Services and you can download them layer by layer. In some cases the layer data is very large. Therefore, the download may take some time.
```{r}
library(remotes)
remotes::install.github("ogdtg/tgAPI")
library(tgAPI)
#install.packages(ggplot2)
#install.packages(dplyr)
library(dplyr)
library(ggplot2)
library(sf)
```
## Get the Features (layers) of the Geodata
Some datsets are raster data. They do not contain layers and they cannot be downloaded, yet.
```{r}
features <- get_geo_features("kantonaler-richtplan")
features
```
## Download the first feature
Features can be downloaded by using their name or their label. The result of the download will be a dat.frame of the class `sf`. You can directly use it for geospatial analysis.
```{r}
feature_num <- 1
geo_data <- get_geo_data("kantonaler-richtplan",features$name[feature_num])
tg_data <- get_geo_data("amtliche-vermessung-av", "Gemeindegrenzen")
head(geo_data)
```
## Analyze Data
```{r}
# Look at the dataset and its structure
summary(geo_data)
```
## Plot Data
The base layer shows the borders of the municipalities (`Gemeindegrenzen`). The downloaded feature is colored red
```{r}
# Plot the data
geo_data %>% ggplot() +geom_sf(data = tg_data) + geom_sf(color = "red") +
labs(title = paste0("Kantonaler Richtplan: ",features$title[feature_num])) +
theme_minimal()
```
## Continue your code here...
```{r}
# Do some data magic with R
```
------------------------------------------------------------------------
## Questions about the data?
Contact us via [Mail](mailto:[email protected]) or visit our [GitHub presence](https://github.com/ogdtg)
------------------------------------------------------------------------
OGD-Koordinationsstelle Kanton Thurgau | Grabenstrasse 8 | 8510 Frauenfeld