[Geoserver-users] text-align for SLD text symbolizer

Hi,

I would like to center a label placement relative a geometry point location the textsymbolizer part of my sld. It doesn’t seem possible to use something like css:text-align=center. Is there a way to achieve the same thing using displacement or anchorpoint? I don’t see how to calculate a label length for a relative displacement? The default placement seems to be css:text-align=left

-10

0

Thanks

Rkgeorge

Hi Randy,
You can use the Anchor point as part of the text symbolizer. Here is an example:

<LabelPlacement>
<PointPlacement>
<AnchorPoint>
<AnchorPointX>0</AnchorPointX>
<AnchorPointY>0.5</AnchorPointY>
</AnchorPoint>

The numbers here mean that 0 (zero) is the left hand side of the label and 0.5 is the middle height of the label. The numbers range from 0 to 1, but you can go out of the bounds I think to really offset the text. These numbers are the percentage length and height of the label.

So if you use 0.5 and 0.5 for the X and Y anchor points, the middle of the label will be located on the point (50% of the length, 50% of the height).

Displacement is in pixels and will offset the label by the amount you specify.

Brent Owens
(The Open Planning Project)

Randy George wrote:

Hi,

I would like to center a label placement relative a geometry point location the textsymbolizer part of my sld. It doesn’t seem possible to use something like css:text-align=center. Is there a way to achieve the same thing using displacement or anchorpoint? I don’t see how to calculate a label length for a relative displacement? The default placement seems to be css:text-align=left

<LabelPlacement>

<PointPlacement>

<Displacement>

<DisplacementX>-10</DisplacementX>

<DisplacementY>0</DisplacementY>

</Displacement>

</PointPlacement>

</LabelPlacement>

Thanks

Rkgeorge

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

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
------------------------------------------------------------------------

_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
  

Hi Brent,

  Thanks for the tip, exactly what I needed!
  It is there in the ogc
"02-070_Styled_Layer_Descriptor_Implementation_Specification.pdf" but I
missed it.

Thanks
Rkgeorge

-----Original Message-----
From: Brent Owens [mailto:brentowens@anonymised.com]
Sent: Wednesday, November 15, 2006 2:04 PM
To: Randy George
Cc: geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] text-align for SLD text symbolizer

Hi Randy,
You can use the Anchor point as part of the text symbolizer. Here is an
example:

<LabelPlacement>
<PointPlacement>
<AnchorPoint>
<AnchorPointX>0</AnchorPointX>
<AnchorPointY>0.5</AnchorPointY>
</AnchorPoint>

The numbers here mean that 0 (zero) is the left hand side of the label
and 0.5 is the middle height of the label. The numbers range from 0 to
1, but you can go out of the bounds I think to really offset the text.
These numbers are the percentage length and height of the label.

So if you use 0.5 and 0.5 for the X and Y anchor points, the middle of
the label will be located on the point (50% of the length, 50% of the
height).

Displacement is in pixels and will offset the label by the amount you
specify.

Brent Owens
(The Open Planning Project)

Randy George wrote:

Hi,

I would like to center a label placement relative a geometry point
location the textsymbolizer part of my sld. It doesn't seem possible
to use something like css:text-align=center. Is there a way to achieve
the same thing using displacement or anchorpoint? I don't see how to
calculate a label length for a relative displacement? The default
placement seems to be css:text-align=left

<LabelPlacement>

<PointPlacement>

<Displacement>

<DisplacementX>-10</DisplacementX>

<DisplacementY>0</DisplacementY>

</Displacement>

</PointPlacement>

</LabelPlacement>

Thanks

Rkgeorge

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

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share

your

opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
------------------------------------------------------------------------

_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users