Newer
Older
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
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")