python-visualization / folium

Python Data. Leaflet.js Maps.
https://python-visualization.github.io/folium/
MIT License
6.94k stars 2.23k forks source link

Italian Cadastre WMS don't render well #1883

Closed agronomofiorentini closed 2 months ago

agronomofiorentini commented 9 months ago

Describe the bug

I would like to add the Italian Cadastre WMS service to folium.

The Italian cadastre releases this service wms under by License CC-BY 4.0.

The following is the code that i am using, but the map is displaying wrong.

I have checked the documentation of the Italian Cadastre WMS and the coordinate reference system by default EPSG:6706.

To Reproduce

import folium

m = folium.Map(location=[47.46901, 9.36688], zoom_start=13)

folium.raster_layers.WmsTileLayer(url = 'https://wms.cartografia.agenziaentrate.gov.it/inspire/wms/ows01.php?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap',
                                  layers = 'Cartografia_Catastale',
                                  transparent = True, 
                                  control = True,
                                  fmt="image/png",
                                  name = 'wms',
                                  overlay = True,
                                  show = True,
                                  ).add_to(m)
folium.LayerControl().add_to(m)

m

Environment:

Additional context I think it's related to the CRS.

Possible solutions Maybe adding the argument crs to set a costum projection to the WmsTileLayer could be the solution?

Conengmo commented 2 months ago

Here on page 5 it says something about the CRS: https://www.agenziaentrate.gov.it/portale/documents/20143/260417/Manuale+consultazione+cartografia_Documentazione+descrittiva+del+servizio+di+consultazione+della+cartografia+catastale+20180611.pdf/35e955f7-2344-56c8-1157-8f7567531660, though I don't read Italian. It seems it uses ETRF2000?

You can pass the CRS as an additional keyword argument to the WMSTileLayer class.

folium.raster_layers.WmsTileLayer(
    url='https://wms.cartografia.agenziaentrate.gov.it/inspire/wms/ows01.php?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap',
    layers='Cartografia_Catastale',
    transparent=True,
    control=True,
    fmt="image/png",
    name='wms',
    overlay=True,
    show=True,
    crs="ETRF2000",
).add_to(m)

Hope that helps!

I'll close the issue since there doesn't seem to be anything to do with Folium. But feel free to share your further findings here.