I can't make this work. I have a JavaScript program that should upload a KML and it does not work. Uploading the same KML manually in Google Maps works perfectly

<!DOCTYPE html>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
    <title>GeoRSS Layers</title>
      /* Always set the map height explicitly to define the size of the div
       * element that contains the map. */
      #map {
        height: 100%;
      /* Optional: Makes the sample page fill the window. */
      html, body {
        height: 100%;
        margin: 0;
        padding: 0;
    <div id="map"></div>
      function initMap() {
        var map = new google.maps.Map(document.getElementById('map'), {
          zoom: 12,
          center: {lat: 40.45, lng: -3.8}
/* otra opcion era 'http://maps.google.com/maps?q=https://github.com/churruscat/files/blob/master/KMLtrak.KML'*/
        var georssLayer = new google.maps.KmlLayer({
          url: 'https://drive.google.com/open?id=15OVgNwtVbLVARkHJD3F8P_bEfG9oJ4Lu',
    <script async defer

1 Answer 1


The Google Drive link that you're using (https://drive.google.com/open?id=15OVgNwtVbLVARkHJD3F8P_bEfG9oJ4Lu) doesn't actually open/download the KML file itself, but rather opens a web page which displays the file. This won't work with the Google Maps API, since that requires a direct link to the KML or KMLZ file itself.

There are ways to get a direct download link for a file hosted in Google Drive (so long as the file is publicly viewable). I'm not sure if it's officially supported, but if you search the web for "google drive direct download link", you should find instructions. for creating a download link with the ID of your file. I think your file should work with this URL:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.