Hello JC,
If you are using MS4W, you can test a GetLegendGraphic request by using
the local demo WMS service that comes with every MS4W install,
out-of-the-box, such as:
https://ms4w.dev/cgi-bin/mapserv.exe?MAP=/ms4w/apps/local-demo/local.map&SERVICE=WMS&VERSION=1.1.1&REQUEST=getlegendgraphic&layer=countries&FORMAT=image/png
(you should be able to modify the url above for 127.0.0.1/ instead)
If that works locally for you, just follow the local-demo.map, for your
own mapfile.
-jeff
--
Jeff McKenna
GatewayGeo: Developers of MS4W, MapServer Consulting and Training
co-founder of FOSS4G
http://gatewaygeo.com/
On 2022-11-07 11:23 a.m., Jean-Christophe Bastin wrote:
Hello,
I have many map files and I’m trying to get legends from them.
I followed the documentation I found :
https://mapserver.org/ogc/wms_server.html#getlegendgraphic-request
<https://mapserver.org/ogc/wms_server.html#getlegendgraphic-request>
The map file I test follows the requirements. I tried many calls :
http://127.0.0.1/cgi-bin/mapserv.exe?MAP=C:/mywms.map&SERVICE=WMS&layer=mylayer&REQUEST=getlegendgraphic&FORMAT=image/png&VERSION=1.0.0
<http://127.0.0.1/cgi-bin/mapserv.exe?MAP=C:/mywms.map&SERVICE=WMS&layer=mylayer&REQUEST=getlegendgraphic&FORMAT=image/png&VERSION=1.0.0>
http://127.0.0.1/cgi-bin/mapserv.exe?MAP=C:/mywms.map&SERVICE=WMS&layer=mylayer&REQUEST=getlegendgraphic&FORMAT=image/png&VERSION=1.1.0
<http://127.0.0.1/cgi-bin/mapserv.exe?MAP=C:/mywms.map&SERVICE=WMS&layer=mylayer&REQUEST=getlegendgraphic&FORMAT=image/png&VERSION=1.1.0>
http://127.0.0.1/cgi-bin/mapserv.exe?MAP=C:/mywms.map&SERVICE=WMS&layer=mylayer&REQUEST=getlegendgraphic&FORMAT=image/png&VERSION=1.1.1
<http://127.0.0.1/cgi-bin/mapserv.exe?MAP=C:/mywms.map&SERVICE=WMS&layer=mylayer&REQUEST=getlegendgraphic&FORMAT=image/png&VERSION=1.1.1>
http://127.0.0.1/cgi-bin/mapserv.exe?MAP=C:/mywms.map&SERVICE=WMS&layer=mylayer&REQUEST=getlegendgraphic&FORMAT=image/png&VERSION=1.3.0&SLD_VERSION=1.1.0
<http://127.0.0.1/cgi-bin/mapserv.exe?MAP=C:/mywms.map&SERVICE=WMS&layer=mylayer&REQUEST=getlegendgraphic&FORMAT=image/png&VERSION=1.3.0&SLD_VERSION=1.1.0>
Each of them give me the error :
readGIF(): General error message. corrupted gif image?: Failed to read
from file
What does that mean ? Am I missing a parameter in my call or something
more in the map file that is not in the documentation ?
Or is it the kind of generic error “I can’t generate your legend, just
find by yourself why” ? XD
Many thanks !
*JCB*
_______________________________________________
MapServer-users mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/mapserver-users