Ticket #1451 (new defect)

Opened 3 years ago

Last modified 4 months ago

Getlegendgraphic with SLD is failing

Reported by: debbie.pagurek@ec.gc.ca Assigned to: 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

11/25/05 16:19:18 changed by assefa

  • owner changed from mapserverbugs to assefa.
  • cc set to mapserver-bugs@dmsolutions.ca.
  • milestone set to 4.8 release.
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.

04/28/07 23:23:16 changed by tomkralidis

  • cc set to tomkralidis.

Any update on this one?

04/30/07 10:41:38 changed by assefa

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

04/30/07 11:39:39 changed by tomkralidis

Using trunk, I'm able to get an SLD-enabled GetLegendGraphic response with no problem:

http://devgeo.cciw.ca/cgi-bin/mapserv/carts?service=WMS&version=1.1.1&request=GetLegendGraphic&layer=cws&format=image/png&sld=http://devgeo.cciw.ca/ms_tmp/ms-trac-1451.sld

However, trying with SLD_BODY looks like the SLD is not picked up:

http://devgeo.cciw.ca/cgi-bin/mapserv/carts?service=WMS&version=1.1.1&request=GetLegendGraphic&layer=cws&format=image/png&sld_body=<StyledLayerDescriptor?%20version="1.0.0"%20xmlns="http://www.opengis.net/sld"%20xmlns:ogc="http://www.opengis.net/ogc"%20xmlns:xlink="http://www.w3.org/1999/xlink"%20xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"%20xsi:schemaLocation="http://www.opengis.net/sld%20http://schemas.opengeospatial.net/sld/1.0.0/StyledLayerDescriptor.xsd"><Name>Pearse</Name><Title>Pearse%20Drainage%20Areas</Title><Abstract>Pearse%20Drainage%20Areas</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?%20name="fill">#FF0000</CssParameter></Fill><Stroke><CssParameter?%20name="stroke">#999999</CssParameter><CssParameter?%20name="stroke-width">2.0</CssParameter></Stroke></PolygonSymbolizer></Rule></FeatureTypeStyle></UserStyle></NamedLayer></StyledLayerDescriptor>

08/10/07 18:23:23 changed by tomkralidis

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>

08/16/07 19:01:33 changed by tomkralidis

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

09/04/07 21:13:06 changed by assefa

  • milestone changed from 5.0 release to FUTURE.

04/28/08 10:38:43 changed by bartvde

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.

04/28/08 10:42:31 changed by bartvde

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