I'm trying to display this WMS in Leaflet / Folium: http://services.data.shom.fr/INSPIRE/wms/r
I use the following code:
import folium
center=[49.9765229931438, 1.1902348134956244]
def inline_map(m, width=800, height=500):
"""Takes a folium instance and embed HTML."""
m._build_map()
srcdoc = m.HTML.replace('"', '"')
embed = HTML('<iframe srcdoc="{}" '
'style="width: {}px; height: {}px; '
'border: none"></iframe>'.format(srcdoc, width, height))
return embed
width, height = 1400, 800
#tileset = r'http://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer/tile/{z}/{y}/{x}'
tileset = r'http://services.data.shom.fr/INSPIRE/wms/r/{z}/{y}/{x}'
map = folium.Map(location=center, zoom_start=10,
#tiles='Stamen Terrain',
tiles = tileset,
#tiles='OpenStreetMap',
width=width,
height=height,
attr="MyDataAttribution")
map.save("mapTEST.html")
When I open mapTEST.html with my brother it does create a leaflet map object, but no tile is displayed, when I use another WMS, it works perfectly. Did I do something wrong with the URL?
Best Answer
From the information I can find at the portal home page the data is provided as a WMS and WMTS layer. Looking at the GetCapabilities shows that it only supports KVP requests while you seem to be trying to access the data as an XYZ layer.
So a request like
http://services.data.shom.fr/clevisu/wmts?layer=SCAN-LITTO_PYR-PNG_WLD_3857_WMTS&style=normal&tilematrixset=3857&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image%2Fpng&TileMatrix=14&TileCol=8002&TileRow=5688
will give you an image:Alternatively you can use a WMS request from the capabilities given.