[OpenLayers-Users] Label position on vector features

Joao Duarte joao.c.duarte at co.sapo.pt
Fri Aug 7 14:29:32 EDT 2009


Hi list,

 

Is there any way to position the label of a vector feature besides the
labelAlign property?

 

I have a vector feature which is a point having an externalGraphic and what
I really would like to do is to specify an offset the label should have
relative to the feature centroid.

 

I checked the drawText method in the Renderers (VML and SVG) and they
determine the position of the label by the feature centroid. But don’t let
the user specify a custom offset.

 

Has anyone thought about this? A simple patch on the drawText method would
do this:

 

var x = (location.x / resolution + this.left + style.labelOffsetX); 

var y = (location.y / resolution - this.top - style.labelOffsetY); 

 

Am I right?

 

João Duarte

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090807/2b2b9955/attachment.html


More information about the Users mailing list