Using SLD with GetLegendGraphic

Michael Schulz mschulz at WEBGIS.DE
Fri Mar 3 00:35:15 PST 2006


Ha! Forgot a crucial part of the whole story:

"Note here that you need to put a <Name>class1</Name> inside the Rule 
element so that a class name is created from the SLD and therefore a 
correct legend image." (wms server howto)

Cheers, Michael


Michael Schulz schrieb:
> Hi,
> 
> yes, mapserver will use the sld also for the legendgraphic. It is 
> however important that you have a class name defined for the layer to 
> return a legendgraphic. Some minimal legend configuration should also be 
> present in the mapfile.
> 
> HTH, Michael
> 
> Miles Jordan schrieb:
> 
>> Hi List,
>>
>> Is it possible to make a getLegendGraphic request, using a SLD to define
>> the style?
>>
>> I'm using the same SLD in a getMap request, which styles the layers
>> appropriately, as I am for a getLegendGraphic request, which shows
>> nothing. If I don't use the SLD, or use a different value in the <Name>
>> element of <NamedLayer>, the default style is shown in the
>> LegendGraphic.
>>
>> I'm only just starrting to look at mapserver, so I might be missing
>> something simple.
>>
>> This is the request I'm using: 
>> http://myserver/cgi-bin/mapserv.exe?map=/ms4w/apps/layers/service/sample
>> _collection.map&service=WMS&REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMA
>> T=image/png&WIDTH=50&HEIGHT=50&LAYER=Humpback_whale_migration&SLD=http:/
>> /myserver/test.sld
>>
>>
>> The SLD:
>> <?xml version="1.0" encoding="UTF-8"?>
>> <StyledLayerDescriptor version="1.0.0"
>> xmlns="http://www.opengis.net/sld"
>> xmlns:ogc="http://www.opengis.net/ogc"
>> xmlns:xlink="http://www.w3.org/1999/xlink"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xsi:schemaLocation="http://www.opengis.net/sld
>> StyledLayerDescriptor.xsd">
>>
>> <NamedLayer>
>>     <Name>Humpback_whale_migration</Name>
>>     <UserStyle>
>>         <Title>Humpback Whale Migration</Title>
>>         <FeatureTypeStyle>
>>             <Rule>
>>                 <LineSymbolizer>
>>                     <Geometry>
>>     
>> <ogc:PropertyName>GEOMETRY</ogc:PropertyName>
>>                     </Geometry>
>>                     <Stroke>
>>                         <CssParameter
>> name="stroke">#000000</CssParameter>
>>                         <CssParameter
>> name="stroke-opacity">1</CssParameter>
>>                         <CssParameter
>> name="stroke-width">2</CssParameter>
>>                         <CssParameter
>> name="stroke-linejoin">Round</CssParameter>
>>                         <CssParameter
>> name="stroke-linecap">Square</CssParameter>
>>                         <CssParameter
>> name="stroke-dasharray">2.0 4.0 4.0 4.0</CssParameter>
>>                         <CssParameter
>> name="stroke-dashoffset">0</CssParameter>
>>                     </Stroke>
>>                 </LineSymbolizer>
>>             </Rule>
>>         </FeatureTypeStyle>
>>     </UserStyle>
>> </NamedLayer>
>>
>> </StyledLayerDescriptor>
>>
>>
>> I'd appreciate any help anyone can offer, thanks.
>>
>>
>> Miles Jordan
>> Applications Developer
>> The Australian Antarctic Data Centre
>>
>> [p] +61 3 6232 3486
>> [f] +61 3 6232 3359
>> [e] miles.jordan at aad.gov.au
>> [w] http://www.aad.gov.au/
>> ___________________________________________________________________________ 
>>
>>
>>     Australian Antarctic Division - Commonwealth of Australia
>> IMPORTANT: This transmission is intended for the addressee only. If 
>> you are not the
>> intended recipient, you are notified that use or dissemination of this 
>> communication is
>> strictly prohibited by Commonwealth law. If you have received this 
>> transmission in error,
>> please notify the sender immediately by e-mail or by telephoning +61 3 
>> 6232 3209 and
>> DELETE the message.
>>         Visit our web site at http://www.aad.gov.au/
>> ___________________________________________________________________________ 
>>
>>
> 
> 


-- 
-----------------------------------------------------------
Michael Schulz                            mschulz at webgis.de

in medias res  Gesellschaft für Informationstechnologie mbH

In den Weihermatten 66              Tel +49 (0)761 556959-5
79108 Freiburg                      Fax +49 (0)761 556959-6

                www.webgis.de / www.zopecms.de
-----------------------------------------------------------
NEU ++ UMN MapServer Hosting ++ http://www.webgis.de ++ NEU
-----------------------------------------------------------



More information about the MapServer-users mailing list