SLD TextSymbolizer issue

Yewondwossen Assefa assefa at DMSOLUTIONS.CA
Fri Nov 19 16:08:23 EST 2004


Do you mean that you expected the label that is appearing in the legend
(for the GetLegendGraphic) to use the same font as the one defined in
the sld ?  If that is the case, from what I know, the font/color used
for the legend in mapserver comes from the LEGEND definition in the map
file. It makes sense to do that since you generally want your legend
labels to look all the same (or maybe not ?).  We could sync the label
elements of the legend object with the values that we have from the SLD
or mapfile but I think It is kind of a hack and there could be potential
  issues with that.

Kralidis,Tom [Burlington] wrote:

> Assefa,
>
> Thanks.  We'll use the <Label>field_name</Label> workaround for now.
>
> Working with this approach, annotation text shows up as expected via
> GetMap with SLD.
>
> When re-testing with GetLegendGraphic, If Rule/Name is defined, then
> this text shows up in the legend image, however in no relation if a font
> def is defined in the SLD?
>
> Example:
>
> GetMap with font fritqat-bold-italic (this font exists in my
> mapfile/WMS):
>
> http://devgeo.cciw.ca/cgi-bin/mapserv/ecows?SERVICE=WMS&VERSION=1.1.1&RE
> QUEST=GetMap&SRS=EPSG%3A4326&BBOX=-173.9403612899645,2.459394278772166,-
> 4.913357430035461,108.1012716912278&WIDTH=560&HEIGHT=350&LAYERS=obs&STYL
> ES=&SLD=http%3A%2F%2Fdevgeo.cciw.ca%2Fms_tmp%2Fobs3.sld&FORMAT=image%2Fp
> ng&BGCOLOR=0xFFFFFF&TRANSPARENT=FALSE&EXCEPTIONS=application%2Fvnd.ogc.s
> e_inimage
>
> GetLegendGraphic
>
> http://devgeo.cciw.ca/cgi-bin/mapserv/ecows?SERVICE=WMS&VERSION=1.1.1&RE
> QUEST=GetLegendGraphic&LAYER=obs&STYLE=sld_01&FORMAT=image%2Fgif&SLD=htt
> p%3A%2F%2Fdevgeo.cciw.ca%2Fms_tmp%2Fobs3.sld
>
> Is this expected behaviour?  If yes, can we enhance GetLegendGraphic
> such that the font of the text matches that defined (if defined) in the
> SLD or mapfile?
>
> ..Tom
>
>
>
>
>>-----Original Message-----
>>From: UMN MapServer Developers List
>>[mailto:MAPSERVER-DEV at LISTS.UMN.EDU] On Behalf Of Yewondwossen Assefa
>>Sent: Friday, 19 November, 2004 14:38
>>To: MAPSERVER-DEV at LISTS.UMN.EDU
>>Subject: Re: [UMN_MAPSERVER-DEV] SLD TextSymbolizer issue
>>
>>
>>I filed a bug on it (Bug 1076) to support both ways. Should
>>not be difficult to do but I have set it to be done after the
>>4.4 release.
>>
>>Later,
>>
>>Kralidis,Tom [Burlington] wrote:
>>
>>
>>>>-----Original Message-----
>>>>From: Yewondwossen Assefa [mailto:assefa at dmsolutions.ca]
>>>>Sent: Friday, 19 November, 2004 14:11
>>>>To: Kralidis,Tom [Burlington]
>>>>Cc: MAPSERVER-DEV at LISTS.UMN.EDU
>>>>Subject: Re: [UMN_MAPSERVER-DEV] SLD TextSymbolizer issue
>>>>
>>>>
>>>>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).
>>>>
>>>
>>>
>>>I retried this with just:
>>>
>>><Label>OBSDATE</Label>
>>>
>>>..and it validated.
>>>
>>>So both constructs are valid; should we support both when ingesting
>>>SLD XML, and output one style when producing?
>>>
>>>..Tom
>>>
>>>
>>>
>>>
>>>>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 ?
>>>>
>>>
>>>
>>>I inserted <Rule><Name> and it worked -- thanks.
>>>
>>>
>>>
>>>
>>>>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&VERS
>>
>>ION=1.1.1&
>>
>>>>>RE
>>>>>
>>>>
>>>>QUEST=GetMap&SRS=EPSG%3A4326&BBOX=-102.9742339843798,32.853526
>>>>53562978,-
>>>>
>>>>58.474233982194,60.66602653699591&WIDTH=560&HEIGHT=350&LAYERS=
>>>>obs&STYLES
>>>>
>>>>=&FORMAT=image%2Fpng&BGCOLOR=0xFFFFFF&TRANSPARENT=FALSE&EXCEPT
>>>>IONS=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_t
>>
>>ests/sld_t
>>
>>>>>ex
>>>>>t_annotation.xml
>>>>>
>>>>>..and tweaked for the layer on my server:
>>>>>
>>>>>
>>>>
>>>>http://devgeo.cciw.ca/cgi-bin/mapserv/ecows?SERVICE=WMS&VERS
>>
>>ION=1.1.1&
>>
>>>>>RE
>>>>>
>>>>
>>>>QUEST=GetMap&SRS=EPSG%3A4326&BBOX=-102.9742339843798,32.853526
>>>>53562978,-
>>>>
>>>>58.474233982194,60.66602653699591&WIDTH=560&HEIGHT=350&LAYERS=
>>>>obs&STYLES
>>>>
>>>>=&FORMAT=image%2Fpng&BGCOLOR=0xFFFFFF&TRANSPARENT=FALSE&EXCEPT
>>>>IONS=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&VERS
>>
>>ION=1.1.1&
>>
>>>>>RE
>>>>>
>>>>
>>>>QUEST=GetMap&SRS=EPSG%3A4326&BBOX=-102.9742339843798,32.853526
>>>>53562978,-
>>>>
>>>>58.474233982194,60.66602653699591&WIDTH=560&HEIGHT=350&LAYERS=
>>>>obs&STYLES
>>>>
>>>>=&FORMAT=image%2Fpng&BGCOLOR=0xFFFFFF&TRANSPARENT=FALSE&EXCEPT
>>>>IONS=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
>>
>>/TextSymbo
>>
>>>>>li
>>>>>zer/Label
>>>>>
>>>>>Whereas the spec defines it like:
>>>>>
>>>>>
>>>>
>>>>/StyledLayerDescriptor/NamedLayer/UserStyle/FeatureTypeStyle
>>
>>/TextSymbo
>>
>>>>>li
>>>>>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
>>>>----------------------------------------------------------------
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>>--
>>----------------------------------------------------------------
>>Assefa Yewondwossen
>>Software Analyst
>>
>>Email: assefa at dmsolutions.ca
>>http://www.dmsolutions.ca/
>>
>>Phone: (613) 565-5056 (ext 14)
>>Fax:   (613) 565-0925
>>----------------------------------------------------------------
>>
>
>
>


--
----------------------------------------------------------------
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