[mapserver-users] Get the legend of a layer .map file

Fawcett, David (MPCA) David.Fawcett at state.mn.us
Thu Sep 23 08:14:29 PDT 2010


If your request URL string currently includes &mode=map, change it to &mode=legend

From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of michele pierri
Sent: Thursday, September 23, 2010 10:12 AM
To: Bob Basques; mapserver-users at lists.osgeo.org
Subject: Re: [mapserver-users] Get the legend of a layer .map file

Can you take me an example,please?
I'm sorry but I am not very expert.
And after how I can do the request via CGI?

CLASS

  EXPRESSION ([pixel] >= 0 AND [pixel] < 20 )

  NAME XXXX <=== IS IT WRIGHT?

  STYLE

   COLOR 0 255 255

  END

END



Thanks again.

--- Gio 23/9/10, Bob Basques <Bob.Basques at ci.stpaul.mn.us> ha scritto:

Da: Bob Basques <Bob.Basques at ci.stpaul.mn.us>
Oggetto: Re: [mapserver-users] Get the legend of a layer .map file
A: mapserver-users at lists.osgeo.org, "michele pierri" <pierm4ci at yahoo.it>
Data: Giovedì 23 settembre 2010, 17:06

Just add in a NAME parameter inside of each CLASS tag set.  You'll need to request the LEGEND object via CGI or orther method, but the NAME vales are used to describe the Legend Chips in the mapserver output.


bobb



>>> michele pierri <pierm4ci at yahoo.it> wrote:

Hi,

I have a file.map like this:





MAP







   NAME"distribution"







   CONFIG  "PROJ_LIB" "/usr/share/proj/"







   STATUS ON







   SHAPEPATH "./"







   PROJECTION







      "init=epsg:4326"





   END





   CONFIG  "MS_ERRORFILE" "/tmp/mapserver.log"





   DEBUG 5





 LAYER





      NAME "tif"





      DATA "/var/www/tmp/a5e1ddfb-6dec-40d0-94e1-ded12f41397e/out/distribution.tiff"





      STATUS DEFAULT





      TYPE RASTER





      CLASSITEM "[pixel]"





CLASS





  EXPRESSION ([pixel] >= 0 AND [pixel] < 20 )





  STYLE





   COLOR 0 255 255





  END





END





CLASS





    EXPRESSION ([pixel] >= 20 AND [pixel] < 40)





   STYLE





     COLOR 0 255 0





   END





END





CLASS





   EXPRESSION ( [pixel] >= 40 AND [pixel] < 60)





   STYLE





    COLOR 255 255 0





   END





END





CLASS





   EXPRESSION ([pixel] >= 60 AND [pixel] < 80)





   STYLE





     COLOR 255 127 0





   END





END





CLASS





   EXPRESSION ([pixel] >= 80 AND [pixel] < 100)





     STYLE





      COLOR 255 0 0





     END





   END





CLASS





   EXPRESSION ([pixel] = 100 )





    STYLE





     COLOR 255 123 0





    END





END





END





END







Can I have returned with the image,  the legend that describes the meaning of the colors?





Thanks in advance.









-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20100923/b3c1fb32/attachment.htm>


More information about the MapServer-users mailing list