[mapserver-users] How to Create Legend for Single Layer

bartvde at osgis.nl bartvde at osgis.nl
Tue Dec 23 03:41:23 EST 2008


Before you call drawLegend, change the visibility of all other layers to
false (status == MS_OFF), the legend only draws for the visible layers.

When you're done, restore the visibility.

Best regards,
Bart

> Hi,
>
>  Thanks  for your great response.I  am not using CGI.I am using  asp
> C#.net.I have created a method which generates legend.But it is doing for
> all the layers.And my layer does  the expression property.based on the
> expression I m displaying polygon.
>
>    Below code is for trying to get legend for single layer.But it is not
> working.
>
>             layer = MapFunction.Map.getLayerByName("TestLayer");
>             classObj classLegend = new classObj(layer);
>             imageObj imagelegend = MapFunction.Map.drawLegend();
>             string strFile ="C:\\temp\\test.png";
>             imagelegend.save(strFile,MapFunction.Map);
>
>
> Thanks
> Venkat.
>
>
> -----Original Message-----
> From: Subha Ramakrishnan [mailto:subha at gslab.com]
> Sent: Tuesday, December 23, 2008 2:00 PM
> To: Venkat Rao Tammineni
> Cc: mapserver-users at lists.osgeo.org
> Subject: Re: [mapserver-users] How to Create Legend for Single Layer
>
> Hi,
>
> You can do so using mode=legend request. Eg:
> "http://localhost/cgi-bin/mapserv?mode=legend&map=mapfile&layer=layer_name"
> This will give the legend only for the layer that you pass in the url.
>
> In addition to this, is there a facility to generate legend for a layer
> with a filter, where the filter takes in parameters passed from URL to
> generate polygons??
>
> Thanks & regards,
> Subha
>
> Venkat Rao Tammineni wrote:
>>
>> Dear All,
>>
>>
>>
>>   I want to create Legend for Single layer. I have 5 layers on my Map.
>> But I  need to generate legend for single layer. Is it possible to
>> generate Legend for single layer. If some one done the same task.
>> Please let me know.
>>
>>
>>
>>  I am waiting for your great response.
>>
>>
>>
>> Thanks,
>>
>> Venkat.
>>
>>
>> --
>> This message has been scanned for viruses and
>> dangerous content by *MailScanner* <http://www.mailscanner.info/>, and
>> is
>> believed to be clean.
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> mapserver-users mailing list
>> mapserver-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>




More information about the mapserver-users mailing list