[OpenLayers-Users] label vector features

Christopher Schmidt crschmidt at metacarta.com
Mon Oct 15 07:47:09 EDT 2007


On Mon, Oct 15, 2007 at 01:06:12PM +0200, Bart van den Eijnden (OSGIS) wrote:
> Hi list,
> 
> is it currently possible to label vector features, i.e. use an attribute to
> provide labels for the vector features (client-side labeling)?

Nope.

> If not, is this even technically viable?

It is somewhat viable to do limited labelling of features with some work
in the SVG renderer. First, one would need to change the transform(-1
1), which requires changing around a bunch of the existing y -this.top
to this.top - y.

Then you would need to add an additional 'svg:text' element to the SVG
parent for each figure -- figuring out where to put the text would be a
not-yet-solved problem. (You could relatively easily just shove it at
the beginning of each feature.) You'll need to attach these to the main
geoms somehow that ensures they get cleaned up on removal (which was the
step I couldn't get in my naive attempts).

Then you're going to need to deal with overlabelling somehow, since SVG
doesn't handle it itself. 

So, it's technically possible, but a bit difficult at the moment.

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list