var layers = response.itemInfo.itemData.operationalLayers; for ( var x = 0; x < layers.length; x++){ alert(layers.id); }
roadLayer = _map.getLayer('Road_Work_2014_7279'); roadLayer.setVisibility(false);
var roadLayer;
function initMap(layers) { roadLayer = _map.getLayer('Road_Work_2014_7279'); roadLayer.setVisibility(false);
function activateLayer(layer) { preSelection(); _selected = null; postSelection(); _layerCurrent = layer; if(_layerCurrent.title == 'C.I.P. Projects') { roadLayer.setVisibility(false); } else {roadLayer.setVisibility(true); }
adaLayer = _map.getLayer('ADA_Ramps_5740'); adaLayer.setVisibility(false);
function initMap(layers) { trailLayer = _map.getLayer('Trail_Lines_7339'); //trailLayer.setVisibility(false); alert(trailLayer); var supportLayers = []; var pointLayers = []; var arrExemptions = []; $.each(POINT_LAYERS_NOT_TO_BE_SHOWN_AS_TABS.split("|"), function(index, value) { arrExemptions.push($.trim(value).toLowerCase()); }); var supportingLayersThatAreClickable = []; $.each(SUPPORTING_LAYERS_THAT_ARE_CLICKABLE.split("|"), function(index, value) { //alert(SUPPORTING_LAYERS_THAT_ARE_CLICKABLE); supportingLayersThatAreClickable.push($.trim(value).toLowerCase()); }); //trailLayer = _map.getLayer(SUPPORTING_LAYERS_THAT_ARE_CLICKABLE); //trailLayer.setVisibility(false); //alert(trailLayer); $.each(layers, function(index,value){ if (value.url == null || value.type == "CSV") { if ( getFeatureSet(value).geometryType == "esriGeometryPoint" && $.inArray(value.title.toLowerCase(), arrExemptions) == -1 ) { pointLayers.push(value); } else { supportLayers.push(value); } } else { // if the layer has an url property (meaning that it comes from a service), just // keep going...it will remain in the map, but won't be query-able. } }); //_trailLayer = _map.getLayer('Trail_Lines_7339'); //_trailLayer.setVisibility(false); //alert(_trailLayer); _initExtent = _map.extent; var supportLayer; $.each(supportLayers,function(index,value) { supportLayer = _map.getLayer($.grep(_map.graphicsLayerIds, function(n,i){return _map.getLayer(n).id == getID(value)})[0]); /////alert(supportLayer); if (supportLayer == null) return; $.each(supportLayer.graphics,function(index,value) { value.attributes.getValueCI = getValueCI; // assign extra method to handle case sensitivity }); if ($.inArray(value.title.toLowerCase(), supportingLayersThatAreClickable) > -1) { dojo.connect(supportLayer, "onMouseOver", baselayer_onMouseOver); dojo.connect(supportLayer, "onMouseOut", baselayer_onMouseOut); dojo.connect(supportLayer, "onClick", baselayer_onClick); } else { dojo.connect(supportLayer, "onClick", function(){unselect()}); } }); var contentLayer; var colorScheme; var colorOrder = COLOR_ORDER.split(","); var colorIndex; $.each(pointLayers,function(index,value) { _map.removeLayer(_map.getLayer($.grep(_map.graphicsLayerIds, function(n,i){return _map.getLayer(n).id == getID(value)})[0])); $.each(getFeatureSet(value).features, function(index,value) { value.attributes.getValueCI = getValueCI; // assign extra method to handle case sensitivity value.attributes[FIELDNAME_ID] = index; // assign internal shortlist id }); /* color index assignment is a weird bit of voodoo. first thing to consider is that layers names actually appear in tabs in reverse order (i.e. last layer in is leftmost tab). this means that we have to invert the color index for things to match right. also, using modulus to handle overflow -- when there are more layers than colors. so, we end up re-using colors but keeping the sequence. */ colorIndex = (pointLayers.length - index - 1) % colorOrder.length; colorScheme = $.grep(COLOR_SCHEMES, function(n,i){ return n.name.toLowerCase() == $.trim(colorOrder[colorIndex].toLowerCase()) })[0]; contentLayer = buildLayer( getFeatureSet(value).features.sort(SortByNumber), colorScheme.iconDir, colorScheme.iconPrefix ); contentLayer.color = colorScheme.color; contentLayer.title = value.title; dojo.connect(contentLayer, "onMouseOver", layer_onMouseOver); dojo.connect(contentLayer, "onMouseOut", layer_onMouseOut); dojo.connect(contentLayer, "onClick", layer_onClick); //alert(contentLayer.title); only the tab layers for this function _map.addLayer(contentLayer); _contentLayers.push(contentLayer); }); _contentLayers.reverse(); $.each(_contentLayers,function(index,value){ $("#tabs").append('<div class="tab" onclick="activateLayer(_contentLayers['+index+'])">'+value.title+'</div>'); }); if ($(".tab").length == 1) $(".tab").css("display", "none"); activateLayer(_contentLayers[0]); dojo.connect(_map.infoWindow,"onHide",infoWindow_onHide); $("#zoomToggle").css("visibility","visible"); $("#whiteOut").fadeOut("slow"); //trailLayer = _map.getLayer('Trail_Lines_7339'); //trailLayer.setVisibility(false); //alert(trailLayer); }
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.