Skip to main content

This was solved by using lyr.layer.getLayers() instead of lyr.getLayers(); and then setInfoTemplate to null on each of those layers.

   //On loading the kml file
   kml.on("load", function(lyr){
      //Extract all of the layers from within the KML 
      var layers = lyr.layer.getLayers();
      //For each of those layers, 
      //1. Set click event to re-center the map to original point
      //2. Set the infoTemplate for each layer to null
      // That way whenever the kml layer is clicked there is no infowindow
      // to display to the users.
      array.forEach(layers, function(l) {
        l.on("click", centerMap);
        l.setInfoTemplate(null);
      });
    });
EJH
  • 53
  • 5