[OpenLayers-Users] popups for markers dynamically generated from KML

Mike Quentel mquentel at rim.com
Wed Apr 16 10:40:32 EDT 2008


I know there is a KML parser and examples that render graphics based on
KML inputs.  Since some of the KML sources I'm using are particularly
huge, instead of having the KML parsed on the client through OL, I have
a server-side KML reader (uses XPath/xalan.jar) that returns lists of
coordinates to the browser client.

So when the client receives a list of point coordinates, it loops
through and adds markers like this: 

for (var i = 0; i < pointsCoordsArray.length; i += 3) {
  x = pointsCoordsArray[i];
  y = pointsCoordsArray[i + 1];
  marker = new OpenLayers.Marker(new OpenLayers.LonLat(x, y),
icon.clone());
  markersLayer.addMarker(marker);          
}

The loop steps by 3 because the point format is lat,lon,altitude.

What I'd like to do is also add a popup for each marker.  I tried
registering a marker mousedown event that would show a popup for
attributes of the marker, but it only shows the attributes for one of
the markers: 

marker.events.register("mousedown", marker, mousedown);

I know many of you have grappled with similar popup problems; I've seen
many posts about popups.  Please, do you have any advice on how to do
this?

Many thanks.
 
Mike Quentel

---------------------------------------------------------------------
This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.



More information about the Users mailing list