[OpenLayers-Users] Trigger a event when draw a Feature

Eric Lemoine eric.lemoine at camptocamp.com
Tue May 15 05:07:02 PDT 2012


On Tue, May 15, 2012 at 11:32 AM, Jose Maeso <sosecon at hotmail.com> wrote:
> Hello,
> I started with OpenLayer a few hours ago and i need a fast and simple
> example where i puts points and show the lat and lon of the point. I used a
> online examples but i can't trigger any function when the point is drawn.
>
> Here is the code: http://pastebin.com/z4LpxBvG
>
> I tried adding this:
>
> layers.events.on({"featureadded": showPoint});
>
> and
>
> point: new OpenLayers.Control.DrawFeature(vectors,
>                                        OpenLayers.Handler.Point,  {
>
> featureAdded:showPoint,
>                                                        displayClass: 'displayPoints'
>                                        } ),
>
> But it didn't work. I'm pretty lost and need help. Thank you very much!

It works for me. See http://jsfiddle.net/7GqFN/3/




-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com


More information about the Users mailing list