[OpenLayers-Users] Aligning label below Vector feature?

Jani Patokallio jpatokal at iki.fi
Fri Oct 16 07:52:02 EDT 2009


Greetings,

The new (for me!) text label feature for Vectors rocks, but is there any
way to align the label *below* the associated feature?

To be specific, I'm using externalGraphics to create icons, and I'd like
to center graphic at the point of interest and put the label below it. 
It would be trivial to put the text at the exact location (align: "cm")
and use graphicYOffset to move the icon out of the way, but when zoomed
out the icon would then be pointing at the wrong place, which is not
acceptable.

As a semi-workaround, I managed to shift the label to the lower right
corner of the icon by using "align: lt" and padding the label with
"\xA0\xA0" (Unicode non-breaking space), but this doesn't properly
account for the width of the icon.  Moving the label to be below the
image with \r, \n or \x-equivalents thereof doesn't work.  I even tried
my hand at hacking OpenLayers.js directly to move _all_ labels 20px or
so down, but couldn't find the right spot.  Any ideas?

Cheers,
-jani




More information about the Users mailing list