1

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 reference WMS 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
1

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:

enter image description here

Alternatively you can use a WMS request from the capabilities given.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.