[Mapserver-users] GetLegendGraphic questions

Bart van den Eijnden bartvde at xs4all.nl
Fri May 7 15:15:52 EDT 2004


Hi Assefa,

my interpretation of the OGC spec is different.

If you do not provide a rule in the request, I think the SLD WMS should 
produce a graphic for each Rule (in Mapserver terms CLASS) combined in one 
image. I don't think it is the intention of the spec to draw them all on 
top of each other though ....

"to produce a graphic that is representative of all of the rules of the 
style." I don't think an image which draws them all on top of each other 
is representative of all the rules of the style. But I must agree the spec 
is a bit vague on this subject.

I will ask on the wms-dev list.

Best regards,
Bart

On Fri, 07 May 2004 15:02:46 -0400, Yewondwossen Assefa 
<assefa at dmsolutions.ca> wrote:

> Hi There,
>
>  From reading the specs, my interpretation of the GetLegendGraphic is 
> that It is supposed to return one image (icon) representing the styles 
> used to render a particular layer.  I don't think It is meant to return 
> an image  containing all the icons for every class that is found in the 
> layer. (If It was implemented that way, It would be impossible for a 
> user to specify adequattly the the width/heigh of the image since he 
> does not really know how many classes are in the layer).
>
>   The other note is that all the classes are drawn on top of each other. 
> Here again the implmentation is based on my interpretaion of the specs 
> (sld1.0 section 12 Map Legends) where the mention the following for the 
> RULE parameter of the GetLegendGraphic request:
>
>    "Rule of style to produce legend graphic for, if applicable. In the
> case that a style has multiple rules but no specific rule is selected,
> then the map server is obligated to produce a graphic that is
> representative of all of the rules of the style."
>
>   Since we do not support RULE for now, drawing all the classes seemed 
> to be the closest interpretation. When/If RULE is supported, the user 
> will have the option to use it to draw a particular class.
>
>
> Later,
>
>
>
>
> Emil Zegers wrote:
>
>> Hello Bart,
>>
>> Don't know if this is the cause but when you look in maplegend.c 
>> msDrawLegendIcon is called in the else part if class is NULL (if class 
>> is NULL all classes should be drawn):
>>
>>   // Call drawLegendIcon with destination (0, 0)
>>   // Return an empty image if lp==NULL || class=NULL   //(If class is 
>> NULL draw the legend for all classes. Modifications done
>>   // Fev 2004 by AY)
>>   if (lp) {
>>     msClearLayerPenValues(lp); // just in case the mapfile has already 
>> been processed
>>     if (class) {
>>       msDrawLegendIcon(map, lp, class, width, height, image->img.gd, 0, 
>> 0);
>>     }
>>     else {
>>       for (i=0; i<lp->numclasses; i++) {
>>         msDrawLegendIcon(map, lp, &lp->class[i], width, height, 
>> image->img.gd, 0, 0);
>>       }
>>     }
>>   }
>>
>> But doesn't it clip every image on top on the former one like this with 
>> dstX en dstY set to 0?
>>
>> Regards,
>>
>> Emil Zegers
>>
>>
>>
>>>>> <bartvde at xs4all.nl> 05/07/04 01:38pm >>>
>>
>> Hi list,
>>
>> I have some questions about the GetLegendGraphic operation in Mapserver.
>>
>> I have a layer in my MAP file which has 5 classes, but when performing a
>> GetLegendGraphic request I only get an image of the last class defined.
>> Should I not get an image of all classes?
>>
>> Also, how do you get the "text labels" for the specific classes, e.g.
>> "0-20%" next to the symbols?
>>
>> Maybe I am missing something in my LAYER definition?
>>
>> This is the request I am using:
>> http://myserver/cgi-bin/mapserv.exe?map=/ms4w/apps/zulte/map/zulte_server..map&layer=kwelder_2000&version=1.1.1&request=GetLegendGraphic&format=image/png 
>> This is my LAYER definition:
>>
>>   LAYER
>>
>>     METADATA
>>       WMS_TITLE "2000_kwelder"
>>       WFS_TITLE "2000_kwelder"
>>       WMS_ABSTRACT "2000_kwelder"
>>       WMS_SRS "epsg:28992"
>>     END
>>     NAME "kwelder_2000"
>>     CONNECTIONTYPE OGR
>>     TILEINDEX "2000.shp"
>>
>>     SIZEUNITS PIXELS
>>     STATUS ON
>>     TOLERANCE 3
>>     TOLERANCEUNITS PIXELS
>>     TYPE POLYGON
>>     DUMP TRUE
>>     TEMPLATE "blank.html"
>>     UNITS METERS
>>     CLASSITEM "Kwelder_to"
>>     CLASS
>>     	EXPRESSION (([Kwelder_to] > 0) AND ([Kwelder_to] <= 20))
>>     	NAME "0-20%"
>>     	COLOR 254 255 212
>>     END
>>     CLASS
>>     	EXPRESSION (([Kwelder_to] > 20) AND ([Kwelder_to] <= 40))
>>     	NAME "21-40%"
>>     	COLOR 255 218 143
>>     END
>>     CLASS
>>     	EXPRESSION (([Kwelder_to] > 40) AND ([Kwelder_to] <= 60))
>>     	NAME "41-60%"
>>     	COLOR 255 151 41
>>     END
>>     CLASS
>>     	EXPRESSION (([Kwelder_to] > 60) AND ([Kwelder_to] <= 80))
>>     	NAME "61-80%"
>>     	COLOR 217 95 13
>>     END
>>     CLASS
>>     	EXPRESSION (([Kwelder_to] > 80) AND ([Kwelder_to] <= 100))
>>     	NAME "81-100%"
>>     	COLOR 153 54 5
>>     END
>>   END
>>
>> Thanks in advance for any info on this subject.
>>
>> Best regards,
>> Bart
>> _______________________________________________
>> Mapserver-users mailing list
>> Mapserver-users at lists.gis.umn.edu 
>> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users __________
>> VChecked
>>
>>
>> ______________________________________________________
>>
>>  This message has been checked for all known viruses
>> ______________________________________________________
>>
>> _______________________________________________
>> Mapserver-users mailing list
>> Mapserver-users at lists.gis.umn.edu
>> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
>>
>
>



-- 
  



More information about the mapserver-users mailing list