title: KML data not being displayed on map?
body: <p>I'm afraid reading through numerous tutorials as well as thoroughly scouring the relevant documentation.</p>
  
  <p>I am using Nokia maps on my website, and am dynamically generating a kml file containing location data pertinent to the individual user. </p>
  
  <p>The KML file is generated and saved successfully.</p>
  
  <p>However, the data is not displayed on the map (no errors arise).</p>
  
  <p>This is the file which queries the DB and generates the KML.</p>
  
  <pre><code> &lt;?php
  
  
  session_start();
  if(isset($_SESSION['login'])){
  
  $userID = ($_SESSION['login']);
  
  header("Content-type: application/vnd.google-earth.kml+xml");
  header("Content-disposition: inline; filename=$userID.kml");
  $con=mysql_connect("****", "****", "****");
  
  mysql_select_db("****");
  
  if ($userID!=null){
  
  $sql1="SELECT * FROM user WHERE userID='$userID'";
  
  $result1 = mysql_query($sql1, $con);
  }
      if (!$result1){
          die ('Invalid Query: ' . mysql_error());
      }
  
  $devIDrow = mysql_fetch_assoc($result1);
  $devIDquery = $devIDrow['uuid'];
  $name = $devIDrow['name'];
  
  $sql2="SELECT * FROM gps WHERE devID='$devIDquery'";
  
  $result2 = mysql_query($sql2, $con);
  
      if (!$result2)
          {
              die ('Invalid Query: ' . mysql_error());
          }
  
  
  
  $dom = new DOMDocument('1.0', 'UTF-8');
  $dom-&gt;formatOutput = true;
  // Iterate through the rows, adding KML nodes for each
  // Creates the root KML element and appends it to the root document.
  $node = $dom-&gt;createElementNS('http://www.opengis.net/kml/2.2', 'kml');
  $parNode = $dom-&gt;appendChild($node);
  
  // Creates a KML Document element and append it to the KML element.
  $dnode = $dom-&gt;createElement('Document');
  $docNode = $parNode-&gt;appendChild($dnode);
  
  while ($row = mysql_fetch_assoc($result2)){
      $dnode = $dom-&gt;createElement("Placemark");
      $newnode = $docNode-&gt;appendChild($dnode);
  
  
      $newnode = $dom-&gt;createElement("displayName");
      $newnode-&gt;nodeValue = $name;
      $dnode-&gt;appendChild($newnode);
  
      $newnode = $dom-&gt;createElement("Description");  
      $newnode-&gt;nodeValue = $row['logTime'];
      $dnode-&gt;appendChild($newnode);
  
      //Coordinates are a child node of the 'Point' node       
      $pointnode = $dom-&gt;createElement("Point");
      $dnode-&gt;appendChild($pointnode);
  
      $coordsnode = $dom-&gt;createElement("Coordinates");
      $coordsnode-&gt;nodeValue = $row['latitude'].",".$row['longitude'];
      $pointnode-&gt;appendChild($coordsnode);
  }
  }
  
  $filename = $userID.".kml";
  $dom-&gt;save($filename);
  
  
  
  
  
  mysql_close($con2);
  header("location:mapsNokia.php");
  
  
  ?&gt;
  </code></pre>
  
  <p>The following is the page which loads up the map</p>
  
  <pre><code>&lt;?php
  session_start();
  $userID = $_SESSION['login'];
  header('Access-Control-Allow-Origin: *');
  
  ?&gt;
  
  &lt;!DOCTYPE html&gt;
  &lt;html xmlns ="http://www.w3.org/1999/xhtml"&gt;  
  &lt;head&gt;
      &lt;title&gt;3D Protect - Map&lt;/title&gt;
      &lt;link rel="stylesheet" type="text/css" href="style.css" /&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
      &lt;meta http-equiv="X-UA-Compatible" content="IE=7" ; IE=EmulateIE9/&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;nav&gt;
              &lt;ul class="fancyNav"&gt;
                  &lt;li id="home"&gt;&lt;a href="http://www.3dprotectsoftware.com/index" class="homeIcon"&gt;Home&lt;/a&gt;&lt;/li&gt;
                  &lt;li id="login"&gt;&lt;a href="http://www.3dprotectsoftware.com/login"&gt;Login&lt;/a&gt;&lt;/li&gt;
                  &lt;li id="store"&gt;&lt;a href="http://www.store.3dprotectsoftware.co.uk/index.php?route=product/product&amp;filter_name=nfc&amp;product_id=50"&gt;Store&lt;/a&gt;&lt;/li&gt;
                  &lt;li id="about"&gt;&lt;a href="http://www.3dprotectsoftware.com/aboutus"&gt;About Us&lt;/a&gt;&lt;/li&gt;
                  &lt;li id="contact"&gt;&lt;a href="http://www.3dprotectsoftware.com/contact"&gt;Contact Us&lt;/a&gt;&lt;/li&gt;
              &lt;/ul&gt;
          &lt;/nav&gt;
      &lt;/ul&gt;
  
  &lt;script type="text/javascript" src="http://api.maps.nokia.com/2.2.4/jsl.js?with=all" charset="utf-8"&gt;&lt;/script&gt;
  
  &lt;div id="map" style="z-index: -1; left:25%; right: 25%; top:25%; bottom: 25%; width: 50%; height: 50%; position: absolute;"&gt;&lt;/div&gt;
  
  &lt;script type="text/javascript"&gt;
  
  
  /*&lt;![CDATA[*/
  /////////////////////////////////////////////////////////////////////////////////////
  // Don't forget to set your API credentials
  //
  // Replace with your appId and token which you can obtain when you 
  // register on http://api.developer.nokia.com/ 
  //
              nokia.Settings.set( "", ""); 
              nokia.Settings.set( "", "");
  
  //          
  /////////////////////////////////////////////////////////////////////////////////////
  
  var map = new nokia.maps.map.Display(document.getElementById("map"),   
                      { components: [ new nokia.maps.map.component.Behavior(),                
                        new nokia.maps.map.component.ZoomBar(),                
                        new nokia.maps.map.component.Overview(),                                             
                        new nokia.maps.map.component.TypeSelector(),                     
                        new nokia.maps.map.component.ScaleBar(),                
                        new nokia.maps.map.component.InfoBubbles() ],                               
                      'zoomLevel': 15,    
                      'center': [54.04541,-2.79916]
                      });
  
      var kml = new nokia.maps.kml.Manager();
          // We define a callback function for parsing kml file,
          // and then push the parsing result to map display
          var onParsed = function (kmlManager) {
                  var resultSet;
                  // KML file was successfully loaded
                  if (kmlManager.state == "finished") {
                          // KML file was successfully parsed
                          resultSet = new nokia.maps.kml.component.KMLResultSet(kmlManager.kmlDocument, map);
                          resultSet.addObserver("state", function (resultSet) {
                                  if (resultSet.state == "finished") {
                                          // Retrieve map objects container from KML resultSet
                                          container = resultSet.container;
  
                                          // Add the container to the map's object collection so they will be rendered onto the map.
                                          map.objects.add(container);
  
                                          // Switch the viewport of the map do show all KML map objects within the container
                                          map.zoomTo(container.getBoundingBox());
                                  }
                          });
                          resultSet.create();                     
                  }
          };
          // Add an observer to kml manager
          kml.addObserver("state", onParsed);
  
  kml.parseKML("http://www.3dprotectsoftware.com/"+'&lt;?php $userID = $_SESSION['login']; echo $userID;?&gt;.kml');
  
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I dont know why the data is not being displayed.</p>
  
  <p>Below is a sample kml file</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;kml xmlns="http://www.opengis.net/kml/2.2"&gt;
    &lt;Document&gt;
      &lt;Placemark&gt;
        &lt;Name&gt;Antwan&lt;/Name&gt;
        &lt;Description&gt;2013-03-18 
  
  20:56:39&lt;/Description&gt;
        &lt;Point&gt;
          &lt;Coordinates&gt;54.04541,-2.79916&lt;/Coordinates&gt;
        &lt;/Point&gt;
      &lt;/Placemark&gt;
      &lt;Placemark&gt;
        &lt;Name&gt;Antwan&lt;/Name&gt;
  
  
  &lt;Description&gt;2013-03-18 21:01:42&lt;/Description&gt;
        &lt;Point&gt;
          &lt;Coordinates&gt;54.04541,-2.79916&lt;/Coordinates&gt;
        &lt;/Point&gt;
      &lt;/Placemark&gt;
  &lt;/Document&gt;
  &lt;/kml&gt;
  </code></pre>
  
  <p>Any help would be greatly appreciated</p>