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?
when I use another WMS, it works perfectly.
Do you mean the ArcGIS example in your code, when you referenceWMS
in that statement? If so you should note that the ArcGIS service is not a WMS. For a WMS you do not specify a tile set using x,y,z coordinates, instead you give a bounding box and image size. – nmtoken Jul 30 '17 at 9:48