-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (68 loc) · 5.36 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: "Parkplatzbelegung Stadt Frauenfeld"
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* **frauenfeld-1**
# **Parkplatzbelegung Stadt Frauenfeld**
[Link to dataset on data.tg.ch](https://data.tg.ch/explore/dataset/frauenfeld-1/information/)
## Description
<p style='font-family: sans-serif;'>Der Datensatz beinhaltet Daten zur Parkplatzbelegung auf fünf öffentlichen Parkplätzen in Frauenfeld, die in städtischer Hand sind: Unteres Mätteli, Oberes Mätteli, Marktplatz (2 Stunden und 10 Stunden), Altstadt (Freie-Strasse, Bankplatz) sowie Zürcherstrasse (Abschnitt Innenstadt). Die Daten werden alle 5 Minuten aktualisiert und beinhalten die Anzahl der belegten, nicht belegbaren und freien Parkplätze, die Gesamtanzahl aller Parkplätze sowie die Koordinaten des jeweiligen Parkplatzes. <br>Die Daten sind Teil des Pilotprojekts Smart Parking Frauenfeld. Mithilfe von Kameras und künstlicher Intelligenz werden hier Daten zur Parksituation auf den jeweiligen Parkplätzen ermittelt.<br></p><p>Aus Kapazitätsgründen können über data.tg.ch immer nur die Daten für den aktuellen Tag direkt heruntergeladen werden. Alle Daten werden jedoch historisiert und können jeweils für einen Monat über folgenden Link als komprimierte CSV-Datei (Zip-Datei) bezogen werden:<br><a href='https://ogdtg.ch/parkdaten/2024_05_parkdaten.csv.gz' target='_blank'>https://ogdtg.ch/parkdaten/2024_09_parkdaten.csv.gz</a> <br>Die URL beinhaltet jeweils den gewünschten Monat für ein Jahr. Mit obigem Link können z. B. Daten für September 2024 (2024-09) bezogen werden.<br></p><p>Die generelle Linkstruktur lautet entsprechend wie folgt: <a href='https://ogdtg.ch/parkdaten/JJJJ_MM_parkdaten.csv.gz' style='font-family: sans-serif; background-color: rgb(255, 255, 255);' target='_blank'>https://ogdtg.ch/parkdaten/JJJJ_MM_parkdaten.csv.gz</a>, wobei JJJJ das Jahr (vierstellig) und MM den Monat (zweistellig) bezeichnet.</p><p></p><p style='font-family: sans-serif;'><b><br>Wichtiger Hinweis:</b><span> Bei den Daten handelt es sich um unvalidierte Messdaten. Fehlerhafte Datenpunkte aufgrund von Messfehlern können daher nicht ausgeschlossen werden.</span><br></p><p style='font-family: sans-serif;'><span><br>Über die </span><a href='https://regiofrauenfeld.citymobile.ch/index.php?brandid=11579&apid=1155685913' style='font-family: sans-serif; background-color: rgb(255, 255, 255);' target='_blank'>Regio Frauenfeld App</a><span> kann </span><span>die aktuelle Parksituation auf den fünf Parkplätze anhand von Echtzeit-Daten geprüft werden.</span></p><p style='font-family: sans-serif;'><span><a href='https://frauenfeld.citymobile.ch/index.php?apid=2096681313'>Link zur Desktopansicht der App</a></span><span><br></span><br></p><p style='font-family: sans-serif;'><br>Datenquelle: Stadt Frauenfeld</p>
## Metadata
- **Issued** :
- **Modified** : 2025-04-28 02:56:18
- **Rights** : CC BY 4.0
- **Keywords** : Frauenfeld , parken, live, parkplatz, marktplatz, app, Oberes Mätteli, Altstatdt, Zürcherstrasse, Parquery, regio frauenfeld app, frei, belegt, belegung, smart, parking, pilotprojekt, kamera, KI, künstliche, intelligenz
## 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("frauenfeld-1")
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("frauenfeld-1",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("Parkplatzbelegung Stadt Frauenfeld: ",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