Text symbolizers: central position

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Text symbolizers: central position

robertdbuckley
Hi,

I was wondering how to ensure that a text symbolizer always gets centered on the point. 

As far as I can see, the default is to anchor the label-text at the point´s 0,0 coordinate ie bottom-lefthand corner of the point. 

Can I change this so that the center of the text gets placed on the center of the point?

At the moment I am playing with 

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

but is there also a css?


or should I be looking at this...

        <Geometry>
          <ogc:Function name="centroid">
            <ogc:PropertyName>the_geom</ogc:PropertyName>
          </ogc:Function>
        </Geometry>


I hope this is understandable.

yours,

Robert

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Geoserver-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users
Yours with thanks, Robert Buckley System: Linux Ubuntu 10.04 Server / Tomcat6 / Geoserver 2.1.2 / GeoWebCache 1.2.6)
Reply | Threaded
Open this post in threaded view
|

Re: Text symbolizers: central position

David Winslow-5
The label placement should do the trick.  In theory AnchorPointX and AnchorPointY should both be set to 0.5 to center the text on the point, but this will take ascenders and descenders into account so maybe the slightly higher AnchorPointY makes sense.

In CSS it's intended for this notation to achieve the same effect:

* { label-anchor: 0.5 0.5 }

If that doesn't work let me know.

--
David Winslow

On Wed, Jul 11, 2012 at 8:23 AM, Robert Buckley <[hidden email]> wrote:
Hi,

I was wondering how to ensure that a text symbolizer always gets centered on the point. 

As far as I can see, the default is to anchor the label-text at the point´s 0,0 coordinate ie bottom-lefthand corner of the point. 

Can I change this so that the center of the text gets placed on the center of the point?

At the moment I am playing with 

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

but is there also a css?


or should I be looking at this...

        <Geometry>
          <ogc:Function name="centroid">
            <ogc:PropertyName>the_geom</ogc:PropertyName>
          </ogc:Function>
        </Geometry>


I hope this is understandable.

yours,

Robert

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Geoserver-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Geoserver-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users