[OpenLayers-Users] Draw a point and assign a dynamic label to it

Frost89 kristian_frost7 at hotmail.com
Wed Mar 24 08:52:02 EDT 2010


Hi list

In my map I have added a vector layer and a drawFeature control.
The drawFeature is set to draw points, and works without problems.

Now, I would like to assign a text-label to the point's style.
The text in the label should be defined by the user (through a prompt() or
other alternatives).

So I was thinking about settings this value in the "featureAdded" event of
the drawFeature control, but I can't quite figure out how to do this.
When I try to do it like this...
var point = new OpenLayers.Control.DrawFeature(
  vectorLayer,
  OpenLayers.Handler.Point,
  {
    type: OpenLayers.Control.TYPE_TOOL,
    featureAdded: function(event) {
      event.style.label = 'test';
      redliningLayer.drawFeature(event);
    }
  }
);
... I just get an error message:
event.style is null
So if anyone has an idea of how to do this, it would be appreciated :)

- Kristian Frost
-- 
View this message in context: http://n2.nabble.com/Draw-a-point-and-assign-a-dynamic-label-to-it-tp4790691p4790691.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list