From 1b17f2cb24005c5ed2665cc57880a61ba86a97a5 Mon Sep 17 00:00:00 2001 From: root <root@Dataport-DA23-72144.dsc.dataport.de> Date: Fri, 3 Jan 2025 15:53:36 +0100 Subject: [PATCH] Added Example 9 Charging Stations --- 09_ChargingStations/example09.py | 51 +++++++++++++ 09_ChargingStations/output.html | 125 +++++++++++++++++++++++++++++++ README.md | 1 + 3 files changed, 177 insertions(+) create mode 100644 09_ChargingStations/example09.py create mode 100644 09_ChargingStations/output.html diff --git a/09_ChargingStations/example09.py b/09_ChargingStations/example09.py new file mode 100644 index 0000000..1f5810c --- /dev/null +++ b/09_ChargingStations/example09.py @@ -0,0 +1,51 @@ +from owslib.wms import WebMapService +from folium import Map, raster_layers, LayerControl + +# Prepare the Web Map Service +wms = WebMapService('https://geoservice.norderstedt.de/geoserver/pub/eLadestation/wms', 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=10, tiles="cartodb positron") + +# Add the first layer to the map (Orthophotos of Norderstedt) +raster_layers.WmsTileLayer( + url='https://geoservice.norderstedt.de/geoserver/dop/dop2020sw/wms', + layers='dop2020sw', + fmt='image/png', + transparent=True, + name='Norderstedt Statdgebiet', + control=True, + overlay=True, + show=True +).add_to(m) + +# Add the second layer to the map (markers of eLadestationen) +raster_layers.WmsTileLayer( + url='https://geoservice.norderstedt.de/geoserver/pub/eLadestation/wms', + layers='eLadestation', + fmt='image/png', + transparent=True, + name='E Ladestation', + 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 diff --git a/09_ChargingStations/output.html b/09_ChargingStations/output.html new file mode 100644 index 0000000..0a82431 --- /dev/null +++ b/09_ChargingStations/output.html @@ -0,0 +1,125 @@ +<!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_cb0c17a824f1b3664dedd7de9f454376 { + 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_cb0c17a824f1b3664dedd7de9f454376" ></div> + +</body> +<script> + + + var map_cb0c17a824f1b3664dedd7de9f454376 = L.map( + "map_cb0c17a824f1b3664dedd7de9f454376", + { + center: [53.70363185991316, 10.006678666505149], + crs: L.CRS.EPSG3857, + ...{ + "zoom": 10, + "zoomControl": true, + "preferCanvas": false, +} + + } + ); + + + + + + var tile_layer_77ca7a49ae72726ddf44868e40038617 = 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_77ca7a49ae72726ddf44868e40038617.addTo(map_cb0c17a824f1b3664dedd7de9f454376); + + + var macro_element_0098308520f7d217e526837e9973712f = L.tileLayer.wms( + "https://geoservice.norderstedt.de/geoserver/dop/dop2020sw/wms", + {"attribution": "", "format": "image/png", "layers": "dop2020sw", "styles": "", "transparent": true, "version": "1.1.1"} + ); + + + macro_element_0098308520f7d217e526837e9973712f.addTo(map_cb0c17a824f1b3664dedd7de9f454376); + + + var macro_element_2c0e38a2707fcfe90d83ffe244c943d7 = L.tileLayer.wms( + "https://geoservice.norderstedt.de/geoserver/pub/eLadestation/wms", + {"attribution": "", "format": "image/png", "layers": "eLadestation", "styles": "", "transparent": true, "version": "1.1.1"} + ); + + + macro_element_2c0e38a2707fcfe90d83ffe244c943d7.addTo(map_cb0c17a824f1b3664dedd7de9f454376); + + + var layer_control_d3f17486481d9693e953530b4daecde3_layers = { + base_layers : { + "cartodbpositron" : tile_layer_77ca7a49ae72726ddf44868e40038617, + }, + overlays : { + "Norderstedt Statdgebiet" : macro_element_0098308520f7d217e526837e9973712f, + "E Ladestation" : macro_element_2c0e38a2707fcfe90d83ffe244c943d7, + }, + }; + let layer_control_d3f17486481d9693e953530b4daecde3 = L.control.layers( + layer_control_d3f17486481d9693e953530b4daecde3_layers.base_layers, + layer_control_d3f17486481d9693e953530b4daecde3_layers.overlays, + { + "position": "topright", + "collapsed": true, + "autoZIndex": true, +} + ).addTo(map_cb0c17a824f1b3664dedd7de9f454376); + + +</script> +</html> \ No newline at end of file diff --git a/README.md b/README.md index 3f4a8da..3bf1573 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ Example # | Name | Description | Input format | Output | Source 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 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 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 11 | Power plant monitoring | Show a box plot (mean, variance, outliers) of the measures of genitron stations at different locations over a one week time window | CSV | Boxplot (PNG) | https://opendata.schleswig-holstein.de/dataset/kfu-messwerte-2024-07-29 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 \ No newline at end of file -- GitLab