[OpenLayers-Users] Vector text labels with offsets?

Stephen Woodbridge woodbri at swoodbridge.com
Fri Mar 12 17:30:44 EST 2010


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



More information about the Users mailing list