AnsweredAssumed Answered

Base layer hides other layers.

Question asked by pascal16 on Mar 14, 2012
Latest reply on Mar 20, 2012 by pascal16
I have two layers, one with multiple layers and another that is my base layer.  When all layers are visible the base layer hides the other layer.  The other layer is still there however, it is under the base layer.  When base layer is set to be invisible (unchecked) the other layers are can be seen.  This starting happening after I upgraded ArcGIS Server from version 9.# (I think 9.3) to 10.  I am using Javascript API version 1.4. 

The map is suppose to look like this:

[ATTACH=CONFIG]12658[/ATTACH]

But it looks like this:

[ATTACH=CONFIG]12659[/ATTACH]

Here is the code for the button that performs show and hide layers:

function updateLayerVisibility() {             //Aerials layer         if ($("#ortho").attr("checked") == false) {             mapLarge.removeLayer(wmsLyr);            }         } else {             mapLarge.addLayer(wmsLyr);             mapLarge.reorderLayer(wmsLyr.id, 0);             }         }                  //Other layers         var inputs = dojo.query(".list_item"), input;         visible = [];         for (var i=0, il=inputs.length; i<il; i++) {           if (inputs[i].checked) {             visible.push(inputs[i].id);           }         }         dynamicMapServiceLayer.setVisibleLayers(visible);          }




function InitLargeMap() {     esriConfig.defaults.map.sliderLabel = null;      mapLarge = new esri.Map("mapLarge"); //, {spatialReference:3424});           curLat = 38.91082763671875 + ((41.34429931640625 - 38.91082763671875)/2);  curLng = -75.5474853515625 + ((-73.9544677734375 - -75.5474853515625)/2);        //init toolbar     toolbar = new esri.toolbars.Navigation(mapLarge);    mapLarge.reposition();   $("#mapLarge").hide();      //layer dialog  $.ui.dialog.defaults.bgiframe = true;  $("#mapLayerList").dialog({ position: [625, 125], height: 250, zIndex: 999, stack: false});  HideLayerList();  $($($("#tblLayers").parent().parent()[0]).siblings(".ui-dialog-titlebar")).append("<img id=\"btnMinMaxLayer\" onclick=\"ToggleLayerList()\" src=\"images/maximize.png\" />");  //$(".ui-dialog-titlebar").append("<img id=\"btnMinMaxLayer\" onclick=\"ToggleLayerList()\" src=\"images/minimize.png\" />");     $('#mapLayerList').hide();   //measure results  $("#measureResults").dialog({ position: [100, 150], height: 80, width:190, zIndex: 999, stack: false});  HideMeasureResults();  //$($($("#distance").parent().parent().parent().parent().parent()[0]).siblings(".ui-dialog-titlebar")).append("<img id=\"btnMinMaxMeasure\" src=\"images/fake-button.png\" />");     $('#measureResults').css('min-height', '0');          //identify results     $("#identifyResults").dialog({position: [65, 135], height: 252, width: 500, resizable: true, zIndex: 999, stack: false});     HideIdentifyResults();     $($($("#idIdentifyResults").parent()[0]).siblings(".ui-dialog-titlebar")).append("<img id=\"btnCloseIdentify\" src=\"images/close.png\" onclick=\"HideIdentifyResults()\" />");     $('#identifyResults').css('height', '226px');          //pdf dialog     $("#printDialog").dialog({ position: [300, 135], height: 180, zIndex: 999, stack: false});     HidePrintDialog();     $($("#printDialog").siblings(".ui-dialog-titlebar")).append("<img id=\"btnMinMaxMeasure\" src=\"images/fake-button.png\" />");     $('#printDialog').css('height', '155px');           //hide close buttons  $('.ui-icon-closethick').hide();    var imageParameters = new esri.layers.ImageParameters();  imageParameters.format = "png32";  //imageParameters.dpi = 192;  dynamicMapServiceLayer = new esri.layers.ArcGISDynamicMapServiceLayer(dynamicServiceURL, { "opacity": 1, "imageParameters": imageParameters });    dojo.connect(dynamicMapServiceLayer, "onLoad", buildLayerList);   dojo.connect(mapLarge.infoWindow, "onShow", function() {      dijit.byId("tabs").resize();  });   //dojo.connect(mapLarge, "onLoad", InitIdentify);    dojo.connect(dynamicMapServiceLayer, "onUpdate", HideSpinner);      extentHandle = dojo.connect(mapLarge, "onExtentChange", LargeExtentChanged);     //dojo.connect(mapLarge, "onLoad", InitPickMP);   //identify proxy page  esriConfig.defaults.io.proxyUrl = "/arcgisserver/apis/javascript/proxy/proxy.ashx";  esriConfig.defaults.io.alwaysUseProxy = false;  geometryService = new esri.tasks.GeometryService("http://"+serverName+"/ArcGIS/rest/services/Geometry/GeometryServer");  dojo.connect(geometryService, "onAreasAndLengthsComplete", outputAreaAndLength);           }        dojo.declare("OIT2007WMS", esri.layers.DynamicMapServiceLayer, {         constructor: function(extentParam) {            this.initialExtent = this.fullExtent = new esri.geometry.Extent(extentParam);                               this.spatialReference = new esri.SpatialReference({wkid:3424});            this.loaded = true;           this.onLoad(this);         },          getImageUrl: function(extent, width, height, callback) {       //to get rid of the black background fill at world extent - request the image as png with transparent bg.  Modify these extents as desired.             if ((extent.xmin < 475800) && (extent.xmax > 561000) && (extent.ymin < 519300) && (extent.ymax > 593300)) {            var params = {             request:"GetMap",      transparent:true,                  format:"image/png",                  version:"1.1.1",                  layers:"Natural2007",                  title:"aerials",                  exceptions:"application/vnd.ogc.se_xml",                                        //changing values                  bbox:extent.xmin + "," + extent.ymin + "," + extent.xmax + "," + extent.ymax,                  srs: "EPSG:" + extent.spatialReference.wkid,                  width: width,                  height: height               };              } else {            var params = {             request:"GetMap",                 format:"image/jpeg",                  version:"1.1.1",                  layers:"Natural2007",                  title:"aerials",                  exceptions:"application/vnd.ogc.se_xml",                                        //changing values                  bbox:extent.xmin + "," + extent.ymin + "," + extent.xmax + "," + extent.ymax,                  srs: "EPSG:" + extent.spatialReference.wkid,                  width: width,                  height: height               };       }       //http://##webmap.state.##.us/##orthos?request=GetMap&transparent=true&format=image%2Fpng&version=1.1.1&layers=Natural2007&exceptions=application%2Fvnd.ogc.se_xml&bbox=-467855.65019169333%2C-9173.69961829785%2C1318527.4629782114%2C963412.661996428&srs=EPSG%3A3424&width=900&height=490           callback("http://####.state.##.us/##orthos?" + dojo.objectToQuery(params));         }       })      var wmsLyr;  function buildLayerList(layer) {     $("#tblLayers").append("<tr><td></td><td width='40px' text-align='center'><input type='checkbox' class='list_item' style='margin-left: 10px;' checked='checked' id='ortho' /></td><td>Aerials 2007</td></tr>");         var infos = layer.layerInfos, info;         var items = [];         for (var i=0, il=infos.length; i<il; i++) {           info = infos[i];             if (info.defaultVisibility) {                 visible.push(info.id);                 $("#tblLayers").append("<tr><td width='40px' text-align='center'><input type='radio' style='margin-left: 10px;' class='list_item' name='LayerList' onclick='IdentifyRBChanged();' value='" + info.name + "' id='" + info.id + "' text=''/></td><td width='40px'><input type='checkbox' style='margin-left: 10px;' class='list_item' checked='" + (info.defaultVisibility ? "checked" : "") + "' id='" + info.id + "' /></td><td>" + info.name + "</td></tr>");             }else{                 $("#tblLayers").append("<tr><td width='40px' text-align='center'><input type='radio' style='margin-left: 10px;' class='list_item' name='LayerList' onclick='IdentifyRBChanged();' value='" + info.name + "' id='" + info.id + "' text=''/></td><td width='40px'><input type='checkbox' style='margin-left: 10px;' class='list_item' id='" + info.id + "' /></td><td>" + info.name + "</td></tr>");             }                      }                  layer.setVisibleLayers(visible);                   //wms layer  var ext = new esri.geometry.Extent(170331.181235106,-9186.80045442859,682773.193783416,963687.823739943,new esri.SpatialReference({"wkid":3424}));  mapLarge.setExtent(ext);  var wmsExtentParam = "{xmin:-325718.125,ymin:-185489.895,xmax:1178188.125,ymax:1139379.895,spatialReference:{wkid:3424}}";  wmsLyr = new OIT2007WMS(wmsExtentParam);       mapLarge.addLayer(wmsLyr);     mapLarge.addLayer(layer);      }

Attachments

Outcomes