[OpenLayers-Users] Vector text labels with offsets?

Brad Spencer brad at cubewerx.com.au
Fri Mar 12 19:45:02 EST 2010


Stephen,

Yes. This can be used to 'explode' several text items clustered around a
single point. For example, stacking several text items vertically as the
same point say at centroid of a polygon feature.

Cheers, Brad.... 

-----Original Message-----
From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] On
Behalf Of Stephen Woodbridge
Sent: Saturday, March 13, 2010 9:31 AM
To: openlayers user list
Subject: [OpenLayers-Users] Vector text labels with offsets?

Hi,

Is it possible to give and offset to the text label position?

I have point features display by 25x25 pixel image. and I would like to 
place a text label centered and above each image. I have tried:

             styleMap = new OpenLayers.StyleMap({
                 "default": new OpenLayers.Style({
                     label: "${name}",
                     fontColor: "black",
                     fontSize: "10px",
                     fontFamily: "Arial",
                     labelAlign: "cb",
                     fillOpacity: 1,
                     pointRadius: 15
                 }),
                 ...

and playing with labelAlign, but the label still passes through the 
image. It would be really great if you could do something like:

                     labelOffset: new OpenLayers.Pixel(0,-10),

and have it shift the label position in Y by -10 pixels.

I looked through the code, but I'm not seeing a way to do that. Does 
anyone else think this would be useful? Is there a patch for this by any 
chance?

-Steve
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list