var lods = [ {"level" : 1, "resolution" : 0.010986328125, "scale" : 4617149.97766929}, {"level" : 2, "resolution" : 0.0054931640625, "scale" : 2308574.98883465} ]; map = new esri.Map("map", { extent: startExtent, lods: lods });
Hi, my mapservice has two layers and I want each to display at different extents. I can see that I can specify this in the map constructor:var lods = [ {"level" : 1, "resolution" : 0.010986328125, "scale" : 4617149.97766929}, {"level" : 2, "resolution" : 0.0054931640625, "scale" : 2308574.98883465} ]; map = new esri.Map("map", { extent: startExtent, lods: lods });
I think I've got the wrong end of the stick here though -- that sets the lods for the map, right? How do I say which layer should be shown at a certain lod?
Thanks in advance,
dojo.connect(map, "onZoomEnd", addAerialLayer); var hasAerialLayer = false; function addAerialLayer() { if (map.getLevel() > 8 && !hasAerialLayer){ map.addLayer(aerialLayer, 1); hasAerialLayer = true; } else if (map.getLevel() < 9 && hasAerialLayer){ map.removeLayer(aerialLayer); hasAerialLayer = false; } }
Thanks for your reply. The data is shared by several apps so I can't do that. I've got something working along these lines:dojo.connect(map, "onZoomEnd", addAerialLayer); var hasAerialLayer = false; function addAerialLayer() { if (map.getLevel() > 8 && !hasAerialLayer){ map.addLayer(aerialLayer, 1); hasAerialLayer = true; } else if (map.getLevel() < 9 && hasAerialLayer){ map.removeLayer(aerialLayer); hasAerialLayer = false; } }