Solved! Go to Solution.
ArcGISDynamicMapServiceLayer agdms = new ArcGISDynamicMapServiceLayer(my_map_server_url); ArcGISLayerInfo[] arcgisLayerInfo = agdms.getAllLayers(); for(int j=0; j<arcgisLayerInfo.length; j++) { arcgisLayerInfo.setVisible(my_boolean_value); }
ArcGISDynamicMapServiceLayer agdms = new ArcGISDynamicMapServiceLayer(my_map_server_url); ArcGISLayerInfo[] arcgisLayerInfo = agdms.getAllLayers(); for(int j=0; j<arcgisLayerInfo.length; j++) { arcgisLayerInfo.setVisible(my_boolean_value); }
map.removeLayer(1); layer = new ArcGISDynamicMapServiceLayer(my_map_server_url,Array_with_layers_I_Want); map.addLayer(layer);
Hi, what I do is something like this, depending what you want:ArcGISDynamicMapServiceLayer agdms = new ArcGISDynamicMapServiceLayer(my_map_server_url); ArcGISLayerInfo[] arcgisLayerInfo = agdms.getAllLayers(); for(int j=0; j<arcgisLayerInfo.length; j++) { arcgisLayerInfo.setVisible(my_boolean_value); }
Let me know if it helps you.
elecUrl = "http://gis2012.emap.co.il/arcgis/rest/services/CompareElections/MapServer";
elecLayer = new esri.layers.ArcGISDynamicMapServiceLayer(elecUrl, {
"id": "elec",
"opacity": 0.7
});
if (elecLayer != null) {
if (map.layerIds.length > 1) {
//var visible = [];
//visible.push(-1);
//elecLayer.setVisibleLayers(visible);
map.removeLayer(elecLayer);
}
else {
elecLayer.setVisibleLayers([0]);
var symbol = new esri.symbol.SimpleFillSymbol();
symbol.setColor(new dojo.Color([150, 150, 150, 0.5]));
var renderer = new esri.renderer.UniqueValueRenderer(symbol, "WinningParty");
renderer.addValue("א�?ת", new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([238, 31, 58, 1])));
renderer.addValue("�?", new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([132, 164, 203, 1])));
renderer.addValue("�?", new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([121, 71, 0, 1])));
renderer.addValue("�?", new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([126, 149, 102, 1])));
renderer.addValue("�?", new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([39, 166, 117, 1])));
renderer.addValue("�?", new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([71, 102, 36, 1])));
renderer.addValue("�?", new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([160, 160, 225, 1])));
renderer.addValue("�?�?", new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([255, 140, 0, 1])));
renderer.addValue("�?", new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([91, 91, 169, 1])));
renderer.addValue("�?�?�?", new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([25, 106, 255, 1])));
renderer.addValue("�?רץ", new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([0, 206, 0, 1])));
renderer.addValue("עם", new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([182, 212, 168, 1])));
renderer.addValue("שס", new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([136, 111, 69, 1])));
// set up the parameters for the dynamic layer
var optionsArray = [];
var drawingOptions = new esri.layers.LayerDrawingOptions();
drawingOptions.renderer = renderer;
optionsArray[0] = drawingOptions;
elecLayer.setLayerDrawingOptions(optionsArray);
// add the layer to the map
try {
map.addLayer(elecLayer);
}
catch (err) {
console.log(err.message);
}
}
Hi, what I do is something like this, depending what you want:ArcGISDynamicMapServiceLayer agdms = new ArcGISDynamicMapServiceLayer(my_map_server_url); ArcGISLayerInfo[] arcgisLayerInfo = agdms.getAllLayers(); for(int j=0; j<arcgisLayerInfo.length; j++) { arcgisLayerInfo.setVisible(my_boolean_value); }
Let me know if it helps you.