Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've created a new code, now its working, put that into your HTML page:</p> <pre><code>&lt;/html&gt; &lt;style type="text/css"&gt; html { height: 100% } body { height: 100%; margin: 0; padding: 0 } #map_canvas { height: 100% } &lt;/style&gt; &lt;script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&amp;sensor=false"&gt; &lt;/script&gt; &lt;script type="text/javascript"&gt; function initialize() { var mapOptions = { center: new google.maps.LatLng(-15.869167, -47.920834), zoom: 3, disableDefaultUI: true, mapTypeId: google.maps.MapTypeId.HYBRID }; var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions); var nyLayer = new google.maps.KmlLayer( 'YOUR_REAL_KML_LINK', { suppressInfoWindows: false, map: map}); google.maps.event.addListener(nYLayer,'click',function(){ infowindow.open(map, nYLayer); }); } &lt;/script&gt; &lt;/head&gt; &lt;body onLoad="initialize()"&gt; &lt;div id="map_canvas" style="width:800; height:400;"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>And use this to generate your KML via PHP using your query:</p> <pre><code>&lt;?php header('Content-Type: application/vnd.google-earth.kml+xml kml'); header('Content-Disposition: attachment; filename="test.kml"'); include('database_config.php'); // Query the database data $result = mysql_query("SELECT * FROM YOUR_DATA_TABLE"); // Print the head of the document echo '&lt;?xml version="1.0" encoding="UTF-8"?&gt;'; echo '&lt;kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom"&gt;'; echo '&lt;Document&gt;'; // Now iterate over all placemarks (rows) while ($row = mysql_fetch_array($result)) { // This writes out a placemark with some data echo '&lt;Placemark&gt;'; echo '&lt;name&gt;'.$row['name'].'&lt;/name&gt;'; echo '&lt;description&gt;'.$row['description'].'&lt;/description&gt;'; echo '&lt;Point&gt;'; echo '&lt;coordinates&gt;'.$row['lng'].' , '.$row['lat'].'&lt;/coordinates&gt;'; echo '&lt;/Point&gt;'; echo '&lt;/Placemark&gt;'; }; // And finish the document echo '&lt;/Document&gt;'; echo '&lt;/kml&gt;'; ?&gt; </code></pre> <p>Simpler! Thanks for your help guys!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload