Get IGN legends for WMS Raster, WMS Vecteur and WMTS webservices
This example visualizes the availability of legends for IGN web services, specifically WMS Raster, WMS Vecteur, and WMTS layers. It shows that 241 out of 598 services have retrievable legend images, while 357 do not. The code downloads a CSV of service metadata from the IGN geoportal, then probes a guessed URL pattern on the geoportail.gouv.fr domain for each layer's legend image using `curl`. Successful results are compiled into an augmented CSV and JSON file, with the legend images stored locally.
AI-generated descriptionGet IGN legends for WMS Raster, WMS Vecteur and WMTS webservices
Context
There is a CSV of available IGN webservices at https://geoservices.ign.fr/documentation/services/tableau_ressources
Most webservices for raster do not return the legend and point to a broken http://api.ign.fr/legendes/ as shown below

Results
From the French geoportal, we guessed the pattern to retrieve image legends and generate an "augmented" default file with the legend image URL link
To get end result look at:
- CSV file ressources_de_services_web_with_legend.csv
- JSON file ressources_de_services_web_with_legend.json
You can also get each legend image as we retrieved them locally in the repository. There are in the zip file
Not all webservices do have a legend, 241 have a legend (present.txt) and 357 do not have (no_present.txt). We didn't analysed the cause for the missing legend e.g hosted somewhere or not useful like for imagery
How it was done
Done on linux using bash.
Look at file get_legends_ign.sh for the recipe