Skip to content
Snippets Groups Projects
Commit 8d84b6f9 authored by Tebbo's avatar Tebbo
Browse files

Added example 16 Bathing Waters

parent bc9f6859
Branches
No related tags found
No related merge requests found
Show a map of all bathing waters in Schleswig-Holstein
Data Source: https://opendata.schleswig-holstein.de/dataset/badegewasser-stammdaten-aktuell
{
"path": "http://efi2.schleswig-holstein.de/bg/opendata/v_badegewaesser_odata.csv",
"encoding": "iso8859-1",
"name": "badegewasser-stammdaten-aktuell",
"profile": "tabular-data-resource",
"format": "csv",
"dialect": {
"delimiter": "|",
"quoteChar": "\"",
"header": false
},
"schema": {
"fields": [
{
"type": "string",
"name": "BADEGEWAESSERID",
"description": "Allgemein gültiger Identifikations-Code des Badegewässers",
"constraints": {
"required": true
}
},
{
"type": "string",
"name": "BADEGEWAESSERNAME",
"description": "Vollständiger Name des Badegewässers"
},
{
"type": "string",
"name": "KURZNAME",
"description": "Kurzname des Badegewässers"
},
{
"type": "string",
"name": "ALLGEMEIN_GEBRAEUCHL_NAME",
"description": "allgemein gebräuchlicher Name des Badegewässers"
},
{
"type": "string",
"name": "GEWAESSERKATEGORIE",
"description": "Art des Wasserkörpers, in dem das Badegewässer liegt",
"constraints": {
"enum": [
"See",
"Küstengewässer",
"Fließgewässer",
"Übergangsgewässer"
]
}
},
{
"type": "string",
"name": "KUESTENGEWAESSER",
"description": "zugehöriges Küstengewässer",
"constraints": {
"enum": [
"Nordsee",
"Ostsee"
]
}
},
{
"type": "string",
"name": "BADEGEWAESSERTYP",
"description": "Status des Badegewässers",
"constraints": {
"enum": [
"bereits bestehendes Badegewässer",
"neues Badegewässer"
]
}
},
{
"name": "WEITEREBESCHREIBUNG",
"type": "string",
"description": "weitere Beschreibung des Badegewässers"
},
{
"name": "BADESTELLENLAENGE",
"type": "integer",
"description": "Länge der Uferlinie der Badestelle in Metern"
},
{
"name": "EUANMELDUNG",
"type": "date",
"format": "%d.%m.%Y",
"description": "Zeitpunkt der Anmeldung bei der EU"
},
{
"name": "EUABMELDUNG",
"type": "date",
"description": "Zeitpunkt der Abmeldung bei der EU",
"format": "%d.%m.%Y"
},
{
"type": "integer",
"name": "FLUSSGEBIETSEINHEITID",
"description": "ID der Flussgebietseinheit, zu der das Badegewässer gehört; Angabe gemäß Berichterstattung nach WRRL"
},
{
"name": "FLUSSGEBIETSEINHEITNAME",
"type": "string",
"description": "Name der Flussgebietseinheit, zu der das Badegewässer gehört; Angabe gemäß Berichterstattung nach WRRL"
},
{
"name": "WASSERKOERPERID",
"type": "string",
"description": "ID des Wasserkörpers, zu dem das Badegewässer gehört; Angabe gemäß Berichterstattung nach WRRL"
},
{
"name": "WASSERKOERPERNAME",
"type": "string",
"description": "Name des Wasserkörpers, zu dem das Badegewässer gehört; Angabe gemäß Berichterstattung nach WRRL"
},
{
"name": "NATWASSERKOERPERID",
"type": "integer",
"description": "ID der nationalen Wassereinheit, zu der das Badegewässer gehört"
},
{
"name": "NATWASSERKOERPERNAME",
"type": "string",
"description": "Name der nationalen Wassereinheit, zu der das Badegewässer gehört"
},
{
"name": "SCHLUESSELWOERTER",
"type": "string",
"description": "zur Suche des Badegewässers in WISE (Water Information System for Europe)"
},
{
"type": "integer",
"name": "KREISNR",
"description": "interne Nummer des Kreises oder der kreisfreien Stadt, der oder die für die Überwachung des Badegewässers zuständig ist"
},
{
"type": "string",
"name": "KREIS",
"description": "Name des Kreises oder der kreisfreien Stadt, der oder die für die Überwachung des Badegewässers zuständig ist"
},
{
"type": "integer",
"name": "GEMEINDENR",
"description": "interne Nummer der Gemeinde, in der das Badegewässer liegt"
},
{
"type": "string",
"name": "GEMEINDE",
"description": "Name der Gemeinde, in der das Badegewässer liegt"
},
{
"type": "number",
"name": "UTM_OST",
"description": "Rechtswert der Lage des Badegewässers im KBS (EPSG:4647, ETRS89 / UTM zone N32)",
"epsg": "4647"
},
{
"type": "number",
"name": "UTM_NORD",
"description": "Hochwert der Lage des Badegewässers im KBS (EPSG:4647, ETRS89 / UTM zone N32)",
"epsg": "4647"
},
{
"type": "number",
"name": "GEOGR_LAENGE",
"rdfProperty": "https://schema.org/longitude",
"description": "Längengrad der Lage des Badegewässers im KBS (EPSG:4326, WGS 84)",
"epsg": "4326"
},
{
"type": "number",
"name": "GEOGR_BREITE",
"description": "Breitengrad der Lage des Badegewässers im KBS (EPSG:4326, WGS 84)",
"epsg": "4326",
"rdfProperty": "https://schema.org/latitude"
},
{
"type": "string",
"name": "BADESTELLENINFORMATION",
"description": "Touristische Informationen zum Badegewässer"
},
{
"type": "string",
"name": "AUSWIRKUNGEN_AUF_BADEGEWAESSER",
"description": "Angabe, ob das Badegewässer anfällig für Beeinträchtigungen ist"
},
{
"type": "string",
"name": "MOEGLICHEBELASTUNGEN",
"description": "Angabe möglicher Belastungsquellen für das Badegewässer"
}
],
"primaryKey": "BADEGEWAESSERID"
}
}
\ No newline at end of file
import matplotlib.pyplot as plt
import geopandas as gpd
from frictionless import validate, steps, Resource, transform
# Method to get a column of a resource with all None values removed
def load_column(resource, column_name):
data = transform(
resource,
steps=[
steps.table_normalize(),
# BADEGEWAESSERID needed because it is the primary key
steps.field_filter(names=["BADEGEWAESSERID", column_name]),
steps.row_filter(formula="{} != None".format(column_name))
]
)
return data
# validate the data with the given resource json
# Also possible to get the newest data by using the url given in the resource json by removing the path argument
resource = Resource("badegewasser-stammdaten-aktuell.json", path="v_badegewaesser_odata.csv")
report = validate(resource)
if report.valid:
print("CSV file validated using frictionless")
# Get the ost column of the data table and convert it to pandas data frame
resource = Resource("badegewasser-stammdaten-aktuell.json")
ost = load_column(resource, "UTM_OST")
ost = ost.to_pandas()
# # Get the nord column of the data table and convert it to pandas data frame
resource = Resource("badegewasser-stammdaten-aktuell.json")
nord = load_column(resource, "UTM_NORD")
nord = nord.to_pandas()
# # Load the Schleswig-Holstein map
sh_df = gpd.read_file("./kreise.min.geojson")
# # plot the map
axes = sh_df.plot()
# # plot the coordinates of the police stations onto the SH map
axes.scatter(ost, nord, c='orange', s=0.5)
# # Turn x and y axis off and save figure
plt.axis('off')
plt.savefig('output.png', dpi=200)
else:
print("The CSV file is not valid:")
print(report.flatten(["rowNumber", "fieldNumber", "type"]))
\ No newline at end of file
This diff is collapsed.
16_BathingWaters/output.png

62.1 KiB

This diff is collapsed.
[project]
name = "16-bathingwaters"
version = "0.1.0"
description = ""
authors = [
{name = "Tebbo Beyer"}
]
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
"matplotlib (>=3.9.2)",
"geopandas (>=1.0.1)",
"frictionless (>=5.18.0)"
]
[tool.poetry]
package-mode = false
[build-system]
requires = ["poetry-core>=2.0.0,<3.0.0"]
build-backend = "poetry.core.masonry.api"
Source diff could not be displayed: it is too large. Options to address this: view the blob.
......@@ -16,4 +16,5 @@ Example # | Name | Description | Input format | Output | Source
12 | KITAs in SH | Show all KITAs colored in their respective educational concept on the OpenStreetMap and hover over for information about them | JSON | OpenStreetMap | https://opendata.schleswig-holstein.de/dataset/kindertagesstaetten-aktuell
13 | Crowdflow in Kiel | Show the received signals of devices in different proximities to a public place in Kiel per day using a histogram | CSV | Multiple Histograms | https://opendata.schleswig-holstein.de/dataset/digitale-personenzahlung-in-der-landeshauptstadt-kiel-odala
14 | Wind turbines map | Show a map of all wind turbines in Schleswig-Holstein | CSV | Scatterplot on map | https://opendata.schleswig-holstein.de/collection/windkraftanlagen
15 | Police Stations map | Show a map of all police stations in Schleswig-Holstein | CSV | Scatterplot on map | https://opendata.schleswig-holstein.de/dataset/polizeidienststellen-2024-07-30
\ No newline at end of file
15 | Police Stations map | Show a map of all police stations in Schleswig-Holstein | CSV | Scatterplot on map | https://opendata.schleswig-holstein.de/dataset/polizeidienststellen-2024-07-30
16 | Bathing Waters map | Show a map of bathing waters in Schleswig-Holstein | CSV | Scatterplot on map | https://opendata.schleswig-holstein.de/dataset/badegewasser-stammdaten-aktuell
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment