[mapserver-users] html legend not working

Raffaele Morelli raffaele.morelli at gmail.com
Mon Aug 3 05:16:27 PDT 2015


Short story: I can't get html legend to work...

legend.html file is in the same directory of the mapfile, as you can see the LABEL block is
a verbatim copy from Mapserver documentation.

The INCLUDE layer is a point layer with CLASS correctly defined.

This my request to test 
http://localhost/cgi-bin/mapserv?MAP=/home/www/geomoose-2.8.0/maps/cen_default//cen_default.map&FORMAT=image/png&TRANSPARENT=TRUE&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&_OLSALT=0.9622128666378558&SRS=EPSG:3857&SCALE=6933486.650500195&WIDTH=250&STYLE=&LAYER=sostegni

The legend is returned a png file, just like TEMPLATE statement wasn't taken into account.


Any hint?

Mapfile:

MAP
    NAME 'XXX'
    UNITS meters
    EXTENT  728034.319166294 4193385.80350739 2183515.00526018 5960168.11180283 

    CONFIG 'MS_ERRORFILE' '/var/log/ms_error.log'
    DEBUG 1
    SIZE 800 600

    SYMBOLSET "/home/www/geomoose-2.8.0/maps/symbols/symbols-catasto.sym"
    FONTSET "/home/www/geomoose-2.8.0/maps/fonts/msfontset.txt"
    RESOLUTION 72

    PROJECTION
        #"init=epsg:32632"
        #"init=epsg:4326"
        "init=epsg:3857"
        #"init=epsg:900913"
    END

    OUTPUTFORMAT
      NAME "png"
      DRIVER AGG/PNG
      MIMETYPE "image/png"
      IMAGEMODE RGB
      EXTENSION "png"
      FORMATOPTION "GAMMA=0.75"
    END
    OUTPUTFORMAT
      NAME "gif"
      DRIVER GD/GIF
      MIMETYPE "image/gif"
      IMAGEMODE PC256
      EXTENSION "gif"
    END
    OUTPUTFORMAT
      NAME "png8"
      DRIVER AGG/PNG8
      MIMETYPE "image/png; mode=8bit"
      IMAGEMODE RGB
      EXTENSION "png"
      FORMATOPTION "QUANTIZE_FORCE=on"
      FORMATOPTION "QUANTIZE_COLORS=256"
      FORMATOPTION "GAMMA=0.75"
    END
    OUTPUTFORMAT
      NAME "jpeg"
      DRIVER AGG/JPEG
      MIMETYPE "image/jpeg"
      IMAGEMODE RGB
      EXTENSION "jpg"
      FORMATOPTION "GAMMA=0.75"
    END
    OUTPUTFORMAT
      NAME "svg"
      DRIVER CAIRO/SVG
      MIMETYPE "image/svg+xml"
      IMAGEMODE RGB
      EXTENSION "svg"
    END
    OUTPUTFORMAT
      NAME "pdf"
      DRIVER CAIRO/PDF
      MIMETYPE "application/x-pdf"
      IMAGEMODE RGB
      EXTENSION "pdf"
    END
    OUTPUTFORMAT
      NAME "GTiff"
      DRIVER GDAL/GTiff
      MIMETYPE "image/tiff"
      IMAGEMODE RGB
      EXTENSION "tif"
    END
    OUTPUTFORMAT
      NAME "kml"
      DRIVER KML
      MIMETYPE "application/vnd.google-earth.kml.xml"
      IMAGEMODE RGB
      EXTENSION "kml"
    END
    OUTPUTFORMAT
      NAME "kmz"
      DRIVER KMZ
      MIMETYPE "application/vnd.google-earth.kmz"
      IMAGEMODE RGB
      EXTENSION "kmz"
    END
    OUTPUTFORMAT
      NAME "cairopng"
      DRIVER CAIRO/PNG
      MIMETYPE "image/png"
      IMAGEMODE RGB
      EXTENSION "png"
    END

    WEB
        IMAGEPATH "/home/www/tmp/"
        IMAGEURL "/ms_tmp/"

        METADATA
            "wms_title"                 "CEN"
            "wms_onlineresource"        "http://localhost/cgi-bin/cen?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities"
            "wms_enable_request"        "*"
            "wms_srs"                   "EPSG:32632 EPSG:4326 EPSG:900913 EPSG:3857"
        END  # Metadata
    END  # Web

    LEGEND
      STATUS ON
      KEYSIZE 18 12
      # LABEL object
      LABEL
        TYPE BITMAP
        SIZE MEDIUM
        COLOR 0 0 89
      END
      TEMPLATE "legend.html"  ### HTML template file
    END

    INCLUDE 'sostegni_italia.map'
END


-- 
«My mama said to get things done
You'd better not mess with Major Tom»



More information about the MapServer-users mailing list