0

I have created a web map application (Javascript API) :

require([
  "esri/map",
  "esri/dijit/InfoWindowLite",
  "esri/InfoTemplate",
  "esri/layers/FeatureLayer",
  "dojo/dom-construct",
  "dojo/domReady!"],
function(
  Map,
  InfoWindowLite,
  InfoTemplate,
  FeatureLayer,
  domConstruct
){
  map = new Map("map", {
    basemap: "topo",
    center: [-85.416, 49.781],
    zoom: 5,
    logo: false});

  TestLayer = new esri.layers.ArcGISDynamicMapServiceLayer(
    "http://Myserver/arcgis/rest/services/TestMAP/MapServer");

  query = new esri.tasks.Query();
  query.returnGeometry = true;
  query.outFields = ["CCSNAME", "DAUID20111" ,"DAUID201_5" ,"DAUID201_9" , "DAUID20_14",  "DAUID20_19", "NAME" , "CITY",  "POST_CODE", "HRUID2007.csv.GPF", "HRUID2007.csv.GPE", "HRUID2007.csv.SPECF", "HRUID2007.csv.SPECE" ];

  symbol = new esri.symbol.SimpleFillSymbol(
    esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(
      esri.symbol.SimpleLineSymbol.STYLE_DASHDOT, new dojo.Color([0,255,0]), 2),new dojo.Color([0,255,0,0]));

  map.addLayer(TestLayer);

In the default zoom level set, 3 map layers from **http://Myserver/arcgis/rest/services/TestMAP/MapServer** are showing up.

How can I change my code so that in the default zoom level I get another 3 layers from this url:

"http://Myserver/arcgis/rest/services/TestMAP2/MapServer"

and then when I zoom in I get the current ones.

1 Answer 1

1

The solution is to add another dynamicMapServiceLayer to the map and declare the levels of the detail (LODs) at which map services in your map will be shown.

Check about this sample on esri Javascript resource page: https://developers.arcgis.com/en/javascript/jssamples/map_switch_layer_on_zoom.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.