[OpenLayers-Users] KML

EGoss at Geosyntec.com EGoss at Geosyntec.com
Thu Feb 25 11:18:57 EST 2010


Sorry,

Here is the kml...

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
  <Placemark>    
	<name>Simple placemark</name>   
 	<description>TP-1</description>   
 	<Point>      
	  <coordinates>-74.0835,42.9065,0</coordinates>    
	</Point>  
  </Placemark>
</kml>

-----Original Message-----
From: Christopher Schmidt [mailto:crschmidt at metacarta.com] 
Sent: Thursday, February 25, 2010 11:11 AM
To: Ed Goss
Cc: users at openlayers.org
Subject: Re: [OpenLayers-Users] KML

On Thu, Feb 25, 2010 at 10:13:09AM -0500, EGoss at Geosyntec.com wrote:
> Does anyone know why the line(s) below would return 'null' or null?
> 
> xmlDoc.getElementsByTagName("description")[0].childNodes[0].nodeValue;

... Without your KML file? How could we know?

-- Chris

> Thanks!
> 
> ///////////////////////PARSING OUT KML INFORMATION//////////////////////////////////////
> 
>                 OpenLayers.loadURL(kmlLayer.url, '', this, setKML);
> 
> /////////////////////////////////////////////////////////////////////////////////////////////
> 
> function setKML(response) {
>     if (response.responseText.indexOf('no results') == -1) {
>         alert(response.responseText);
>         var xmlDoc = response.responseXML.documentElement;
>         //var xmlDoc = response.responseText;
> 
>      var name =
>        xmlDoc.getElementsByTagName("name")[0].childNodes[0].nodeValue;
>      alert(name);
> 
>      var description =
>        xmlDoc.getElementsByTagName("description")[0].childNodes[0].nodeValue;
>      alert(description);
> 
>      var coordinates =
>        xmlDoc.getElementsByTagName("coordinates")[0].childNodes[0].nodeValue;
>      alert(coordinates);
> 
>      var content = '<table border="1" cellpadding="1" cellspacing="1">';
>      content += '<tr><th>Name</th><th>Description</th><th>Coordinates</th></tr>';
>      content += '<tr><td>'+name+'</td><td>'+description+'</td><td>'+coordinates+'</td></tr>';
>      content += '</table>';
> 
>      document.getElementById('content').innerHTML = content;
> 
>    }
> }
> 
> 

> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users


-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list