Hi,
following a report from a user I was checking the SLD/SE specifications
about the meaning of PerpendicularOffset
------------------------------------------------------------------
The PerpendicularOffset element of a LinePlacement gives the perpendicular
distance away from a line to draw a label. It is defined simply as:
<xs:element name="PerpendicularOffset"
type="sld:ParameterValueType"/>
The distance is in pixels and is positive to the left-hand side of the line string. Negative
numbers mean right. The default offset is 0.
-------------------------------------------------------------------
By implementing the spec to the letter it seems that a horizontal
road labels would appear either above or below the line depending
on the orientation of the line.
What we do instead considers the eventual label flipping, that
we do to keep the label readable, and flips the offset as well.
In other words, if you consider a horizontal line oriented
from east to west with positive offset, the natural position
of the label would be below the line, and upside down,
but in order to keep it readable we flip both the label and
the offset and end up with a label that is above the line
and readable.
Now, for road labeling this is what I would honestly expect
from a positive value ("positive must mean above, right?")
yet that is not what the spec says for lines oriented from
east to west.
Now, the user in question has a legit case for want the
labels below: he wants to label the border or a polygon
the way google does it for state/province borders.
See the Wisconsin/Iowa border here for an example: http://maps.google.com/?ie=UTF8&ll=42.599598,-90.702095&spn=0.185244,0.445976&z=12
Besides that, we're not really respecting the spec...
So, what shall we do? I was thinking to provide a
new vendor options "absoluteOffset" true/false that
would control if we adjust the offset or follow the
spec by the letter (anyone with a better name?)
The bigger question is, what will be the default.
Do we follow the spec by the letter by default, even if
it does not make much sense and it will break backwards
compatibility for uDig/GeoTools/GeoServer users, or
we default on our current behavior?
Or we roll a global flag to determine what the default
would be (a rendering hint?)
Cheers
Andrea
--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.