[Geoserver-users] text artefacts on SLD rendering if Rotation=0

Dear all,

I think I’ve come across an SLD rendering bug in GeoServer 2.5.0.

Rendering city names with this SLD (only relevant snippet here):

sld:TextSymbolizer
sld:Label
ogc:PropertyNamename</ogc:PropertyName>
</sld:Label>
sld:Font
<sld:CssParameter name=“font-family”>Arial</sld:CssParameter>
<sld:CssParameter name=“font-size”>10</sld:CssParameter>
<sld:CssParameter name=“font-style”>normal</sld:CssParameter>
<sld:CssParameter name=“font-weight”>normal</sld:CssParameter>
</sld:Font>
sld:LabelPlacement
sld:PointPlacement
sld:AnchorPoint
sld:AnchorPointX0</sld:AnchorPointX>
sld:AnchorPointY0.5</sld:AnchorPointY>
</sld:AnchorPoint>
sld:Displacement
sld:DisplacementX3</sld:DisplacementX>
sld:DisplacementY9</sld:DisplacementY>
</sld:Displacement>
sld:Rotation0</sld:Rotation>
</sld:PointPlacement>
</sld:LabelPlacement>
sld:Fill
<sld:CssParameter name=“fill”>#000000</sld:CssParameter>
</sld:Fill>
</sld:TextSymbolizer>

This results in an image as given in the attachment CityName_NO_Rotation.png. You can clearly see that the text very hard to read. This does not happen if there is another layer (any color) below the text layer (e.g. as in a grouped layer).

Just addin a Rotation to the above, i.e. changing Rotation to:

sld:Rotation-1</sld:Rotation>

fixes the issue. The resulting image looks as given in the attachment CityName_Rotation-1.png then. The text is now slidely rotated (hardly visible) but the text artefacts are now gone and the font is readable.

Any ideas? Should I open a bug on Jira for this?

Regards,

Jens

PS The bug also occurs on GeoServer 2.4.4

CityNames_SLD_NO_Rotation.png

CityNames_SLD_Rotation-1.png

On Fri, Apr 11, 2014 at 10:40 AM, Nachtigall, Jens (init) <
Jens.Nachtigall@anonymised.com> wrote:

Dear all,

I think I've come across an SLD rendering bug in GeoServer 2.5.0.

Rendering city names with this SLD (only relevant snippet here):

      <sld:TextSymbolizer>
         <sld:Label>
           <ogc:PropertyName>name</ogc:PropertyName>
         </sld:Label>
         <sld:Font>
              <sld:CssParameter name="font-family">Arial</sld:CssParameter
>
              <sld:CssParameter name="font-size">10</sld:CssParameter>
              <sld:CssParameter name="font-style">normal</sld:CssParameter
>
              <sld:CssParameter name="font-weight">normal</
sld:CssParameter>
         </sld:Font>
         <sld:LabelPlacement>
           <sld:PointPlacement>
             <sld:AnchorPoint>
               <sld:AnchorPointX>0</sld:AnchorPointX>
               <sld:AnchorPointY>0.5</sld:AnchorPointY>
             </sld:AnchorPoint>
             <sld:Displacement>
               <sld:DisplacementX>3</sld:DisplacementX>
               <sld:DisplacementY>9</sld:DisplacementY>
             </sld:Displacement>
              <sld:Rotation>0</sld:Rotation>
           </sld:PointPlacement>
         </sld:LabelPlacement>
         <sld:Fill>
           <sld:CssParameter name="fill">#000000</sld:CssParameter>
         </sld:Fill>
       </sld:TextSymbolizer>

This results in an image as given in the attachment
CityName_NO_Rotation.png. You can clearly see that the text very hard to
read. This does not happen if there is another layer (any color) below the
text layer (e.g. as in a grouped layer).

Just addin a Rotation to the above, i.e. changing Rotation to:

<sld:Rotation>-1</sld:Rotation>

fixes the issue. The resulting image looks as given in the attachment CityName_Rotation-1.png
then. The text is now slidely rotated (hardly visible) but the text
artefacts are now gone and the font is readable.

Any ideas? Should I open a bug on Jira for this?

There is already one, it's the Java 7 text rendering unfortunately:
http://jira.codehaus.org/browse/GEOS-5486?jql=project%20%3D%20GEOS%20AND%20status%20%3D%20Open%20AND%20text%20~%20"text%20java%207"

This is a regression in Java itself, while there are small workarounds, we
still haven't found a good general solution

Cheers
Andrea

--

Meet us at GEO Business 2014! in London! Visit http://goo.gl/fES3aK
for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------