SLD TextSymbolizer issue

Yewondwossen Assefa assefa at DMSOLUTIONS.CA
Fri Nov 19 14:11:10 EST 2004


Tom,

  Here is my understanding of the specs concerning the
sld:ParameterValueType" (which is taken form the sld 1.0 doc section 11.1.3)


<xs:element name="CssParameter" type="sld:ParameterValueType"/>
<xs:complexType name="ParameterValueType" mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="ogc:expression"/>
</xs:choice>
</xs:complexType>

The parameter values are allowed to be complex expressions for maximum
flexibility.
The ‘mixed="true"’ definition means that regular text may be mixed in
with various sub-expressions, implying a text-substitution model for
parameter values. Numeric and character-string data types are not
distinguished, which may cause some complications.

Here are some usage examples:

<CssParameter name="stroke-width">3</CssParameter>

<CssParameter name="stroke-width">
<ogc:Literal>3</ogc:Literal>
</CssParameter>

<CssParameter name="stroke-width">
<ogc:Add>
<ogc:PropertyName>A</ogc:PropertyName>
<ogc:Literal>2</ogc:Literal>
</ogc:Add>
</CssParameter>

<Label>This is city "<ogc:PropertyName>NAME</ogc:PropertyName>"
of state <ogc:PropertyName>STATE</ogc:PropertyName></Label>


I think supporting <Label>label_value</Label> should be valid. I
downladed your sld file and fter adding the schemas at the top, It did
valiadte using xml-spy. Does It make sense ?
(Note that I initially was supporting  the label inside a propertyName
and the code is still there but commented out).


Looking into the GetLegndGraphics : I do not really understand when you
say "for any TextSymbolizer types". Normally any sld passed to the wms
(GetMap or GetLegendGraphic) ends up creating mapserver classes (both
request use the same sld parsing function), so If and sld is applied and
the classes are created for GetMap, there is no reason that these
classes would not be created when doing a GetLegendGraphic.  I think
from your SLD, the elements <Name> is missing from the <Rule>, which is
supposed to be used as the class name. Could it be the reason ?


Later,




Kralidis,Tom [Burlington] wrote:

> Hi,
>
> We've been doing some testing of MapServer with SLD for labelling layers
> and have seem to run into issues.  Orginally, we had issues with
> specifying fonts, however, upon deeper investigation, the problem may be
> elsewhere.
>
> Use case:
>
> Here's a GetMap on a simple layer:
>
> http://devgeo.cciw.ca/cgi-bin/mapserv/ecows?SERVICE=WMS&VERSION=1.1.1&RE
> QUEST=GetMap&SRS=EPSG%3A4326&BBOX=-102.9742339843798,32.85352653562978,-
> 58.474233982194,60.66602653699591&WIDTH=560&HEIGHT=350&LAYERS=obs&STYLES
> =&FORMAT=image%2Fpng&BGCOLOR=0xFFFFFF&TRANSPARENT=FALSE&EXCEPTIONS=appli
> cation/vnd.ogc.se_xml&
>
> Here's the same GetMap with an SLD:
>
> http://devgeo.cciw.ca/ms_tmp/obs1.sld
>
> ..which was copied from the example at:
>
> http://www2.dmsolutions.ca/msapps/world_testdata/tests/sld_tests/sld_tex
> t_annotation.xml
>
> ..and tweaked for the layer on my server:
>
> http://devgeo.cciw.ca/cgi-bin/mapserv/ecows?SERVICE=WMS&VERSION=1.1.1&RE
> QUEST=GetMap&SRS=EPSG%3A4326&BBOX=-102.9742339843798,32.85352653562978,-
> 58.474233982194,60.66602653699591&WIDTH=560&HEIGHT=350&LAYERS=obs&STYLES
> =&FORMAT=image%2Fpng&BGCOLOR=0xFFFFFF&TRANSPARENT=FALSE&EXCEPTIONS=appli
> cation/vnd.ogc.se_xml&SLD=http://devgeo.cciw.ca/ms_tmp/obs1.sld
>
> ..which gives us back what we are expecting.  However, this is not a
> valid SLD document.  When I create a valid SLD document:
>
> http://devgeo.cciw.ca/ms_tmp/obs2.sld
>
> And run the same GetMap with this SLD:
>
> http://devgeo.cciw.ca/cgi-bin/mapserv/ecows?SERVICE=WMS&VERSION=1.1.1&RE
> QUEST=GetMap&SRS=EPSG%3A4326&BBOX=-102.9742339843798,32.85352653562978,-
> 58.474233982194,60.66602653699591&WIDTH=560&HEIGHT=350&LAYERS=obs&STYLES
> =&FORMAT=image%2Fpng&BGCOLOR=0xFFFFFF&TRANSPARENT=FALSE&EXCEPTIONS=appli
> cation/vnd.ogc.se_xml&SLD=http://devgeo.cciw.ca/ms_tmp/obs2.sld
>
> I get an Exception to the effect of:
>
> <?xml version='1.0' encoding="ISO-8859-1" standalone="no" ?>
> <!DOCTYPE ServiceExceptionReport SYSTEM
> "http://schemas.opengeospatial.net/wms/1.1.1/exception_1_1_1.dtd">
> <ServiceExceptionReport version="1.1.1">
> <ServiceException>
> msDrawMap(): Image handling error. Failed to draw layer named
> &#39;obs&#39;.
> msDBFGetItemIndex(): DBASE file error. Item &#39;PropertyName&#39; not
> found.
> </ServiceException>
> </ServiceExceptionReport>
>
> In addition, GetLegendGraphic requests do not work (for any
> TextSymbolizer types, actually).
>
> Looking at the two SLD documents in question, the working SLD (which is
> not valid) looks for the label property as:
>
> /StyledLayerDescriptor/NamedLayer/UserStyle/FeatureTypeStyle/TextSymboli
> zer/Label
>
> Whereas the spec defines it like:
>
> /StyledLayerDescriptor/NamedLayer/UserStyle/FeatureTypeStyle/TextSymboli
> zer/Label/ogc:PropertyName
>
> Comments?
>
> ..Tom
>
>


--
----------------------------------------------------------------
Assefa Yewondwossen
Software Analyst

Email: assefa at dmsolutions.ca
http://www.dmsolutions.ca/

Phone: (613) 565-5056 (ext 14)
Fax:   (613) 565-0925
----------------------------------------------------------------



More information about the mapserver-dev mailing list