Skip to content
Snippets Groups Projects
Commit 9f702c81 authored by Tebbo's avatar Tebbo
Browse files

Added Example 07

parent 134450bf
No related branches found
No related tags found
No related merge requests found
Show the administrative borders of Schleswig-Holstein on an interactive map
Data Source: https://opendata.schleswig-holstein.de/dataset/alkis-schleswig-holstein-ohne-eigentumerangaben
\ No newline at end of file
from owslib.wms import WebMapService
from folium import Map, raster_layers, LayerControl
# Prepare the Web Map Service
wms = WebMapService('https://dienste.gdi-sh.de/WMS_SH_ALKIS_VWG_OpenGBD', version='1.3.0')
# Print information about the Web Map Service
print(f"WMS version: {wms.identification.version}")
print(f"WMS title: {wms.identification.title}")
print(f"Provider name: {wms.provider.name}")
# Get the Layers offered by the Web Map Service
layers = list(wms.contents.keys())
print("Layers: ", layers)
# Get the bounding box of the map of the first layer
bbox = wms.contents[layers[0]].boundingBox
# Calculate the center of the bounding box
center= ( bbox[1]+((bbox[3]-bbox[1]) / 2), bbox[0]+((bbox[2]-bbox[0]) / 2))
# Create the underlying Map
m = Map( location=center, zoom_start=9, tiles="cartodb positron")
# Add the first layer to the map (lines of Gemeindegrenze)
raster_layers.WmsTileLayer(
url='https://dienste.gdi-sh.de/WMS_SH_ALKIS_VWG_OpenGBD',
layers='gmd',
fmt='image/png',
transparent=True,
name='Gemeindegrenze',
control=True,
overlay=True,
show=True
).add_to(m)
# Add the second layer to the map (lines of Landkreisgrenze)
raster_layers.WmsTileLayer(
url='https://dienste.gdi-sh.de/WMS_SH_ALKIS_VWG_OpenGBD',
layers='lk',
fmt='image/png',
transparent=True,
name='Landkreisgrenze',
control=True,
overlay=True,
show=True
).add_to(m)
# Add a Control Panel to the top right to modify the shown Layers
LayerControl().add_to(m)
m.save("output.html")
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<script>
L_NO_TOUCH = false;
L_DISABLE_3D = false;
</script>
<style>html, body {width: 100%;height: 100%;margin: 0;padding: 0;}</style>
<style>#map {position:absolute;top:0;bottom:0;right:0;left:0;}</style>
<script src="https://cdn.jsdelivr.net/npm/leaflet@1.9.3/dist/leaflet.js"></script>
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet@1.9.3/dist/leaflet.css"/>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css"/>
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css"/>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.2.0/css/all.min.css"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css"/>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/python-visualization/folium/folium/templates/leaflet.awesome.rotate.min.css"/>
<meta name="viewport" content="width=device-width,
initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<style>
#map_0db5c8db0819cd65558ab1822c9490e6 {
position: relative;
width: 100.0%;
height: 100.0%;
left: 0.0%;
top: 0.0%;
}
.leaflet-container { font-size: 1rem; }
</style>
</head>
<body>
<div class="folium-map" id="map_0db5c8db0819cd65558ab1822c9490e6" ></div>
</body>
<script>
var map_0db5c8db0819cd65558ab1822c9490e6 = L.map(
"map_0db5c8db0819cd65558ab1822c9490e6",
{
center: [54.30159664854645, 9.63065551265899],
crs: L.CRS.EPSG3857,
...{
"zoom": 9,
"zoomControl": true,
"preferCanvas": false,
}
}
);
var tile_layer_968965775c4638124c10d57d0075772e = L.tileLayer(
"https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png",
{
"minZoom": 0,
"maxZoom": 20,
"maxNativeZoom": 20,
"noWrap": false,
"attribution": "\u0026copy; \u003ca href=\"https://www.openstreetmap.org/copyright\"\u003eOpenStreetMap\u003c/a\u003e contributors \u0026copy; \u003ca href=\"https://carto.com/attributions\"\u003eCARTO\u003c/a\u003e",
"subdomains": "abcd",
"detectRetina": false,
"tms": false,
"opacity": 1,
}
);
tile_layer_968965775c4638124c10d57d0075772e.addTo(map_0db5c8db0819cd65558ab1822c9490e6);
var macro_element_91ab6c0259509300f7965cab9a8c6fde = L.tileLayer.wms(
"https://dienste.gdi-sh.de/WMS_SH_ALKIS_VWG_OpenGBD",
{"attribution": "", "format": "image/png", "layers": "gmd", "styles": "", "transparent": true, "version": "1.1.1"}
);
macro_element_91ab6c0259509300f7965cab9a8c6fde.addTo(map_0db5c8db0819cd65558ab1822c9490e6);
var macro_element_9d4efe726aabf1056eb3e20f0260f926 = L.tileLayer.wms(
"https://dienste.gdi-sh.de/WMS_SH_ALKIS_VWG_OpenGBD",
{"attribution": "", "format": "image/png", "layers": "lk", "styles": "", "transparent": true, "version": "1.1.1"}
);
macro_element_9d4efe726aabf1056eb3e20f0260f926.addTo(map_0db5c8db0819cd65558ab1822c9490e6);
var layer_control_92ed780dfb0b18b4d9b38dc36605e848_layers = {
base_layers : {
"cartodbpositron" : tile_layer_968965775c4638124c10d57d0075772e,
},
overlays : {
"Gemeindegrenze" : macro_element_91ab6c0259509300f7965cab9a8c6fde,
"Landkreisgrenze" : macro_element_9d4efe726aabf1056eb3e20f0260f926,
},
};
let layer_control_92ed780dfb0b18b4d9b38dc36605e848 = L.control.layers(
layer_control_92ed780dfb0b18b4d9b38dc36605e848_layers.base_layers,
layer_control_92ed780dfb0b18b4d9b38dc36605e848_layers.overlays,
{
"position": "topright",
"collapsed": true,
"autoZIndex": true,
}
).addTo(map_0db5c8db0819cd65558ab1822c9490e6);
</script>
</html>
\ No newline at end of file
07_AlkisAdministrativeBorders/output.png

1.01 MiB

This diff is collapsed.
[project]
name = "07-alkisadministrativeborders"
version = "0.1.0"
description = ""
authors = [
{name = "Tebbo Beyer"}
]
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
"owslib (>=0.32.0)",
"folium (>=0.19.2)"
]
[tool.poetry]
package-mode = false
[build-system]
requires = ["poetry-core>=2.0.0,<3.0.0"]
build-backend = "poetry.core.masonry.api"
...@@ -9,6 +9,7 @@ Example # | Name | Description | Input format | Output | Source ...@@ -9,6 +9,7 @@ Example # | Name | Description | Input format | Output | Source
04 | Water measuring stations | Display all water level measuring stations in Schleswig-Holstein using the folium library with OpenStreetMap | CSV | OpenStreetMap overlay | https://opendata.schleswig-holstein.de/dataset/pegel-stammdaten 04 | Water measuring stations | Display all water level measuring stations in Schleswig-Holstein using the folium library with OpenStreetMap | CSV | OpenStreetMap overlay | https://opendata.schleswig-holstein.de/dataset/pegel-stammdaten
05 | Park bench map | Show a map of all park benches in the city of Norderstedt | SHP (shape file) | Table, Open Street Map overlay | https://opendata.schleswig-holstein.de/dataset/parkbanke 05 | Park bench map | Show a map of all park benches in the city of Norderstedt | SHP (shape file) | Table, Open Street Map overlay | https://opendata.schleswig-holstein.de/dataset/parkbanke
06 | Tax office map | Create a formatted HTML and map containing all tax offices in Schleswig-Holstein | RDF | HTML table, Open Street Map overlay | https://opendata.schleswig-holstein.de/dataset/finanzamter-2024-01-28 06 | Tax office map | Create a formatted HTML and map containing all tax offices in Schleswig-Holstein | RDF | HTML table, Open Street Map overlay | https://opendata.schleswig-holstein.de/dataset/finanzamter-2024-01-28
07 | ALKIS Administrative Borders | Show the administrative borders of Schleswig-Holstein | WMS | HTML, OpenStreetMap Overlay | https://opendata.schleswig-holstein.de/dataset/alkis-schleswig-holstein-ohne-eigentumerangaben
08 | Water height diagram | Create a line diagram of the water height of the Stoer near Willenscharen for 2023 | CSV | Diagram (PNG) | https://opendata.schleswig-holstein.de/dataset/wasserstand-pegel-willenscharen-stor1 08 | Water height diagram | Create a line diagram of the water height of the Stoer near Willenscharen for 2023 | CSV | Diagram (PNG) | https://opendata.schleswig-holstein.de/dataset/wasserstand-pegel-willenscharen-stor1
09 | Car Charging Stations | Show the Charging Stations for electric cars on Orthophotos map of Norderstedt | WMS | HTML, OpenStreetMap Overlay | https://opendata.schleswig-holstein.de/dataset/e-ladestationen , https://opendata.schleswig-holstein.de/dataset/orthofotos-2020 09 | Car Charging Stations | Show the Charging Stations for electric cars on Orthophotos map of Norderstedt | WMS | HTML, OpenStreetMap Overlay | https://opendata.schleswig-holstein.de/dataset/e-ladestationen , https://opendata.schleswig-holstein.de/dataset/orthofotos-2020
10 | Redispatch SH-Netz AG | Show a scatter plot of the number of EEG plants of a commune and the amount of time the electricity supply needed to be reduced | CSV | Scatterplot (PNG) | https://opendata.schleswig-holstein.de/dataset/redispatch-2022-08 10 | Redispatch SH-Netz AG | Show a scatter plot of the number of EEG plants of a commune and the amount of time the electricity supply needed to be reduced | CSV | Scatterplot (PNG) | https://opendata.schleswig-holstein.de/dataset/redispatch-2022-08
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment