Question

I am trying to import a bunch of KML files from the server and then adding them to the Map. I have an overall count of 23 KML files on the server which i plan to import on the map.

However what i experience is that it would only allow me to import 18 kml layer on the map not more than that. The moment i add an extra one in the list it would just not show anything but than a plan Google map.

Is there a limitation on the number of KML files i can import on a map ? If yes is there a way to work around because i have 23 files in all.

  var ctaLayer1 = new google.maps.KmlLayer({
    url:'http://www.xyz.com/cfv/maps/1ALL.kml'
  });

  var ctaLayer2 = new google.maps.KmlLayer({
    url:'http://www.xyz.com/cfv/maps/2ALL.kml'
  });

  ctaLayer1.setMap(map);
  ctaLayer2.setMap(map);
  ctaLayer3.setMap(map);
  ctaLayer4.setMap(map);
  ctaLayer5.setMap(map);
  ctaLayer6.setMap(map);  
  ctaLayer7.setMap(map);
  ctaLayer8.setMap(map);
  ctaLayer9.setMap(map);  
  ctaLayer10.setMap(map);
  ctaLayer11.setMap(map);
  ctaLayer12.setMap(map);  
  ctaLayer13.setMap(map);
  ctaLayer14.setMap(map);
  ctaLayer15.setMap(map);  
  ctaLayer16.setMap(map);

  //ctaLayer17.setMap(map);
  //ctaLayer18.setMap(map);  

  ctaLayer19.setMap(map);
  ctaLayer20.setMap(map);

  // ctaLayer21.setMap(map);
  // ctaLayer22.setMap(map);
  //ctaLayer23.setMap(map);  
Was it helpful?

Solution

There is a limit. Check google docs:

There is a limit on the number of KML Layers that can be displayed on a single Google Map. If you exceed this limit, none of your layers will display. The limit is based on the total length of all URLs passed to the KMLLayer class, and consequently will vary by application; on average, you should be able to load between 10 and 20 layers without hitting the limit.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top