Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am building a webmap with the ESRI Javascript API. I am trying to add several KML layers, as well as a Legend Toggle and am repeatedly getting "Internal KML Parser Error" and only some of my layers are appearing on my map. All of my KMLs are publicly available, display properly in Google Earth, are under 10MB, and I'm using API 3.1. The layers that do appear work perfectly in the legend. I'm attempting to add upwards of 20 KML layers in total. My code is as follows (I apologize for not having the actual data, but it's proprietary):

var boundLayers = [];

var kml1 = new esri.layers.KMLLayer('publicURL',{id:'kml1'}); 
boundLayers.push({layer:kml1,title:'Layer 1'});

var kml2 = new esri.layers.KMLLayer('publicURL',{id:'kml2'}); 
boundLayers.push({layer:kml2,title:'Layer 2'});

var kml3 = new esri.layers.KMLLayer('publicURL',{id:'kml3'}); 
boundLayers.push({layer:kml3,title:'Layer 3'});

var kml4 = new esri.layers.KMLLayer('',{id:'kml4'}); 

if(legend){ legend.destroy(); }
var legend = new esri.dijit.Legend({



        //add check boxes 
          var layerNameB = layer.title;
          var checkBoxB = new dijit.form.CheckBox({
            name: "checkBoxB" +,
            checked: layer.layer.visible,
            onChange: function(evt) {
              var blayer = map.getLayer(this.value);
                if (blayer.visible) {
              } else {
              this.checked = blayer.visible;

          //add the check box and label to the toc
          var checkLabelB = dojo.create('label',{'for', innerHTML:layerNameB},checkBoxB.domNode,"after");
  "<br />",checkLabelB,"after");

Any thoughts?

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.