[OpenLayers-Users] Feature/Marker/Popup

Nils Weinander nils.weinander at curalia.se
Mon Feb 25 02:26:51 EST 2008


I haven't quiet grasped how Feature, Marker and Popup are intended
to work together. In order to put a series of clickable markers on
my map I have a loop in the init() function where I:

* Create a Feature using the coordinates of each point
* Call Feature.createMarker() to create a marker
* Add the marker to the marker layer
* Call Feature.createPopup() to create an anchored popup
* Add the popup to the map
* Hide the popup

Now, I would prefer to use a single set of event handler functions
on the markers, where I can display the popup anchored to the
marker's feature on mouseover and hide it again on mouseout.

However, since the event is bound to the marker and the marker
doesn't have a reference to the feature it was created from, I
don't have a reference to the popup. So I have to create a
separate set of event handler functions for each marker. As
long as there are only a few markers I guess this isn't a big
problem, but it is certainly a clumsy solution. So, what have
I missed?

I have done a similar thing with a TextLayer, but there I have
less control, cannot use mouseover/mouseout for example.

-- 
Nils Weinander  |  Systems Designer
Phone +46 (0)8 410 064 56
Mobile +46 (0)70 978 28 37
--
Curalia AB  |  www.curalia.se
Västmannagatan 15, 111 24 Stockholm, Sweden
--



More information about the Users mailing list