Opened 19 years ago

Closed 15 years ago

#1451 closed defect (fixed)

Getlegendgraphic with SLD is failing

Reported by: debbie.pagurek@… Owned by: assefa
Priority: high Milestone: FUTURE
Component: WMS Server Version: 4.6
Severity: normal Keywords:
Cc: tomkralidis

Description

Can't apply an SLD to a getlegendgraphic request. The documentation at
http://mapserver.gis.umn.edu/doc46/wms-server-howto.html#getlegendgraphic says
that you can do this. It's returning a blank screen.

Also tried it with SLD_BODY instead of SLD and it returns a regular
getlegendgraphic request but seems to ignore the SLD_BODY.

http://localhost/cgi-bin/mapserv.exe?map=c:\ms4w\apps\chameleon\cesi\map\mapfile1.map&service=wms&version=1.1.1&request=getlegendgraphic&layer=pearseshape&format=image/gif&sld=http://localhost/chameleon/cesi/sldpearseshape.xml



This is a polygon layer with an SLD with polygonsymbolizer as shown below.
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<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
http://schemas.opengeospatial.net/sld/1.0.0/StyledLayerDescriptor.xsd">
	<Name>Pearse</Name>
	<Title>Pearse Drainage Areas</Title>
	<Abstract>Pearse Drainage Areas</Abstract>
	<NamedLayer>
		<Name>pearseshape</Name>
		<UserStyle>
		        <Name>PearseStyle</Name>
			<Title>PearseStyle</Title>
			<IsDefault>1</IsDefault>
			<FeatureTypeStyle>
				<Rule>
					<ogc:Filter>
						<ogc:PropertyIsEqualTo>
							<ogc:PropertyName>PEARSEDA</ogc:PropertyName>
							<ogc:Literal>Arctic Coast - Islands</ogc:Literal>
						</ogc:PropertyIsEqualTo>
					</ogc:Filter>
					<PolygonSymbolizer>
						<Geometry>
							<PropertyName>the_area</PropertyName>
						</Geometry>
						<Fill>
							<CssParameter name="fill">#000000</CssParameter>
						</Fill>
						<Stroke>
							<CssParameter name="stroke">#999999</CssParameter>
							<CssParameter name="stroke-width">2.0</CssParameter>
						</Stroke>
					</PolygonSymbolizer>
				</Rule>
			</FeatureTypeStyle>
		</UserStyle>
	</NamedLayer>
</StyledLayerDescriptor>

Change History (12)

comment:1 by assefa, 18 years ago

Cc: mapserver-bugs@… added
Milestone: 4.8 release
Owner: changed from mapserverbugs to assefa
The problem is that the sld does not have a <NAME> for the rule. The <NAME> 
parameter is used to set the class name.  If the class name is empty the 
legend won't be drawn in Mapserver.
I have changed the code so that if a name parameter is missing from the sld, 
the class name is set to Unknown. 
I am not sure why It ignores the SLD_BODY, It is supposed to do the same thing 
(if the sld_body points to a valid sld xml). looking into it.

comment:2 by tomkralidis, 17 years ago

Cc: tomkralidis added

Any update on this one?

comment:3 by assefa, 17 years ago

Is this reproducable : using and SLD/SLDBODY with a name should give a valid legend.

comment:5 by tomkralidis, 17 years ago

Assefa: is SLD_BODY being processed at all via mapwms.c? The call is there, but doesn't seem to do anything.

http://devgeo.cciw.ca/cgi-bin/mapserv/carts?service=WMS&version=1.1.1&request=GetLegendGraphic&layer=cws&format=image/png&sld_body=<StyledLayerDescriptor><Name>Pearse</Name><Title>Pearse Drainage Areas</Title><Abstract>Pearse Drainage Areas</Abstract><NamedLayer><Name>cws</Name><UserStyle><Name>PearseStyle</Name><Title>PearseStyle</Title><IsDefault>1</IsDefault><FeatureTypeStyle><Rule><Name>foo</Name><PolygonSymbolizer><Geometry><PropertyName>msGeometry</PropertyName></Geometry><Fill><CssParameter name="fill">#FF0000</CssParameter></Fill><Stroke><CssParameter name="stroke">#999999</CssParameter><CssParameter name="stroke-width">2.0</CssParameter></Stroke></PolygonSymbolizer></Rule></FeatureTypeStyle></UserStyle></NamedLayer></StyledLayerDescriptor>

comment:6 by tomkralidis, 17 years ago

Looks like the SLD_BODY value is being truncated and hence not being processed.

We need to 1./ throw in some better error handling across mapogcsld.c 2./ allocate more space to an SLD_BODY param

comment:7 by assefa, 17 years ago

Milestone: 5.0 releaseFUTURE

comment:8 by bartvde, 16 years ago

Hey Tom, I am running into this one as well unfortunately with 5.0.2. Is there any quick fix that you can think of? Much appreciated.

comment:9 by bartvde, 16 years ago

Sorry I was sending the value unencoded which caused this. After using encodeURIComponent in javascript it works fine.

comment:10 by tomkralidis, 15 years ago

Assefa: Just tried this again. Per comment:6. Any ideas?

comment:11 by assefa, 15 years ago

Tom,

Trying this, I found that if the sld_body content is url-encoded, I get the expected result. Could you please give it a try.

Thanks

http://devgeo.cciw.ca/cgi-bin/mapserv/carts?service=WMS&version=1.1.1&request=GetLegendGraphic&layer=cws&format=image/png&sld_body=%3CStyledLayerDescriptor++version%3D%221.0.0%22+xmlns%3D%22http%3A%2F%2Fwww.opengis.net%2Fsld%22+xmlns%3Aogc%3D%22http%3A%2F%2Fwww.opengis.net%2Fogc%22+xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22+xmlns%3Axsi%3D%22http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema-instance%22+xsi%3AschemaLocation%3D%22http%3A%2F%2Fwww.opengis.net%2Fsld+http%3A%2F%2Fschemas.opengeospatial.net%2Fsld%2F1.0.0%2FStyledLayerDescriptor.xsd%22%3E%3CName%3EPearse%3C%2FName%3E%3CTitle%3EPearse+Drainage+Areas%3C%2FTitle%3E%3CAbstract%3EPearse+Drainage+Areas%3C%2FAbstract%3E%3CNamedLayer%3E%3CName%3Ecws%3C%2FName%3E%3CUserStyle%3E%3CName%3EPearseStyle%3C%2FName%3E%3CTitle%3EPearseStyle%3C%2FTitle%3E%3CIsDefault%3E1%3C%2FIsDefault%3E%3CFeatureTypeStyle%3E%3CRule%3E%3CName%3Efoo%3C%2FName%3E%3CPolygonSymbolizer%3E%3CGeometry%3E%3CPropertyName%3EmsGeometry%3C%2FPropertyName%3E%3C%2FGeometry%3E%3CFill%3E%3CCssParameter+name%3D%22fill%22%3E%23FF0000%3C%2FCssParameter%3E%3C%2FFill%3E%3CStroke%3E%3CCssParameter+name%3D%22stroke%22%3E%23999999%3C%2FCssParameter%3E%3CCssParameter+name%3D%22stroke-width%22%3E2.0%3C%2FCssParameter%3E%3C%2FStroke%3E%3C%2FPolygonSymbolizer%3E%3C%2FRule%3E%3C%2FFeatureTypeStyle%3E%3C%2FUserStyle%3E%3C%2FNamedLayer%3E%3C%2FStyledLayerDescriptor%3E

comment:12 by tomkralidis, 15 years ago

Resolution: fixed
Status: newclosed

Assefa: this works for me.

Note: See TracTickets for help on using tickets.