[OpenLayers-Users] OpenLayers Events - click

EGoss at Geosyntec.com EGoss at Geosyntec.com
Mon Mar 1 13:39:14 EST 2010


Hello all,

I saw an email last week concerning a new user that moved from the Google Maps API to OpenLayers. I have also used Google, and I was able return info from a kml file to an info box. However, I am terribly lost trying to do this using OpenLayers. Does anyone have advice on how to extract the <name> and/or <description> from a kml file to an alert box?

var kmlLayer = new OpenLayers.Layer.GML("KML", "KML/kml1.kml",
                {
                 format: OpenLayers.Format.KML,
                 projection: map.displayProjection,
                 formatOptions: {
                   extractStyles: true,
                   extractAttributes: true
                }
                });

                map.addLayer(kmlLayer);



<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
  <Placemark>
               <name>placemark</name>
               <description>Location X</description>
               <Point>
                 <coordinates>-74,43,0</coordinates>
               </Point>
  </Placemark>
</kml>

Thanks again,
Ed


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100301/1d98d10e/attachment.html


More information about the Users mailing list