'multipleDefine' error when attempting to add ArcGISImageServiceLayer

175
0
06-04-2021 11:21 AM
FranklinAlexander
Occasional Contributor II

This error is becoming a major problem and I am completely mystified on what to do about it. I already addressed the issue with the arcgis javascript loading before the JQuery libraries, so I know this is not the issue. The error pops up this time when I try and load a ArcGISImageServiceLayer from a REST service. This should be very simple, I have NOT defined anything twice. The error gives no information, so I narrowed the suspect code down by simply commenting out code until I could be sure of the exact code block that is throwing the error. 

 

mo._addBioVolumeLayer = function(year, map) {
    console.log("map ", map);
    let bioLyr = map.getLayer("Bio Volume Fisheries");
    console.log("bioLyr ", bioLyr);
    if (bioLyr) {
        map.removeLayer(bioLyr);
    }
    console.log("adding bio-volume data to map for year ", year);
    let Url = "https://MyDomain...._BioVolume" + year + "/ImageServer";     
    let bioVolume = new ArcGISImageServiceLayer(Url, {
      id: "Bio Volume Fisheries",
      opacity: 0
    }); 
    map.addLayer(bioVolume, 1);
}

 

Here is the error:

multipleDefineError.png

I don't know what to look for under 'info' to give me a clue where to look to fix the error. In the code above, if I comment out where I define 'bioVolume' I don't get an error. Also, I am loading a Graphics layer in the same .js file without issue.

 

Tags (1)
0 Kudos
0 Replies