Sporadic kml internal parser error.

600
1
08-07-2012 07:02 AM
RonaldHenderson
New Contributor
I have the following code to add 7 kmz files for estimating flood-inundation for a creek in Kansas. When I first built the page this code worked fine and the map loaded all the layers normally. Recently I have started getting sporadic errors saying some of the files didn't load because of "internal kml parser errors", but its not always for the same files. If I then load them using the Chrome console, they all load, and then when I refresh the page they will load normally. Does anyone have any ideas what might be going on?

var kmlLayers = ["http://ks.water.usgs.gov/esrimaps/17ft.kmz",
                     "http://ks.water.usgs.gov/esrimaps/18ft.kmz",
                     "http://ks.water.usgs.gov/esrimaps/19ft.kmz",
                     "http://ks.water.usgs.gov/esrimaps/20ft.kmz",
                     "http://ks.water.usgs.gov/esrimaps/21ft.kmz",
                     "http://ks.water.usgs.gov/esrimaps/22ft.kmz",
                     "http://ks.water.usgs.gov/esrimaps/23ft.kmz"]
    
    for (i = 0; i < kmlLayers.length; i++){
      var kml = new esri.layers.KMLLayer(kmlLayers, {id:String(i + 1)});
      map.addLayer(kml);
      if (i != 0){
        kml.setVisibility(false);
      }
      dojo.connect(kml, 'onLoad', setTrans);
    }
0 Kudos
1 Reply
RonaldHenderson
New Contributor
I didn't find out what the original problem with this code was, but I ended up fixing it by loading each layer as it was selected instead of loading them all at the start. Haven't had any problems with any of the layers since. It looks like it may have been a problem with the url to kml utility handling concurrent requests.
0 Kudos