title: How to create a google map with kml layer overlay dynamically
body: <pre><code>function initialize() {
      var myOptions = {
        center: new google.maps.LatLng(23.71181,90.407467),
        zoom: 8,
        mapTypeId: google.maps.MapTypeId.ROADMAP
      };
      var map = new google.maps.Map(document.getElementById("map_canvas"),
          myOptions);
      var map_coverage = new google.maps.KmlLayer('http://mydomain.com/myfile.kmz'  );
      map_coverage.setMap(map);       
      map.setZoom(12);
      map.setCenter(dhaka_latlng);    
    }
  </code></pre>
  
  <p>Above code outputs the following map with kmllayer and the kml file has been created with Google earth and saved as a kmz (compressed) file on the server. This file contains some xml data and the colored area represents some coordinates in a tag along with other tags like</p>
  
  <pre><code>&lt;coordinates&gt;
      90.27401489730001,23.9502580159,0 90.2740186914,23.95007761100001 ... so on
  &lt;/coordinates&gt;
  </code></pre>
  
  <p>I want to dynamically create a similar map with kmllayer using javascript api-v3 but without help of Google earth. I mean i want to create kml file using php and save it on the server as somefile.kmz. Is that possible ? Any kinds of help will be appreciated. Thanks !</p>
  
  <p><strong>I can post the original kml file if you need but it's to large</strong></p>
  
  <p><img src="https://i.stack.imgur.com/8aDw0.png" alt="enter image description here"></p>