sadi09
sadi09

Reputation: 23

How to link multiple kml in google map

I need to load many more kml files like this. How can i do so?

<script>
  var map;
  var src = 'https://sites.google.com/site/pdbkml/pdbmap/pdb.kmz';

Or is there any way to merge multiple kmls into one?

Upvotes: 1

Views: 3322

Answers (2)

Ted Daniels
Ted Daniels

Reputation: 1

There is a limit of about 20 kml layers you can display depending upon the length of the URL to each KML file. If you exceed the limit no kml files will display and you get a js error

Upvotes: 0

ScaisEdge
ScaisEdge

Reputation: 133370

You can use more kmlLayer

    function initMap() {
      var map = new google.maps.Map(document.getElementById('map'), {
        zoom: 11,
        center: {lat: 45.1, lng: 12.1}
      });

      var kmlLayer1 = new google.maps.KmlLayer({
        url: 'http://your_domain/your_path/yourkml1.kml',
        map: map
      });

      var kmlLayer2 = new google.maps.KmlLayer({
        url: 'http://your_domain/your_path/yourkml2.kml',
        map: map
      });
      var kmlLayer3 = new google.maps.KmlLayer({
        url: 'http://your_domain/your_path/yourkml3.kml',
        map: map
      });


    }
  </script>

Upvotes: 3

Related Questions