function mapReady(map){ dojo.connect(map,"onClick",executeIdentifyTask); var scalebar = new esri.dijit.Scalebar({ map: map, scalebarUnit:'english' }); //create identify tasks and setup parameters identifyTask = new esri.tasks.IdentifyTask("http://www.geoiddata.com/ArcGIS/rest/services/Pleasanton/Pleasanton/MapServer"); identifyParams = new esri.tasks.IdentifyParameters(); identifyParams.tolerance = 3; identifyParams.returnGeometry = true; identifyParams.layerIds = [3,4]; identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_ALL; identifyParams.width = map.width; identifyParams.height = map.height; //resize the map when the browser resizes dojo.connect(dijit.byId('map'), 'resize', map,map.resize); }
You need to assign a value to the lods option in the esri.Map constructor to limit the zoom levels.
That's the way to go. I've posted examples of how to do this in the past, most recently here: http://forums.arcgis.com/threads/68743-Removing-LODS-after-the-map-has-loaded?p=239740&viewfull=1#po...
be careful though, while it works for max, it does not work for minimum if you use setLevel.
for example, if you do LOD 4-16, and then do setLevel(4) it goes to the 4th level, which in this case is level 7. Very counter intuitive.
lods: [ {"level" : 0, "resolution" : 2445.98490512499, "scale" : 9244648.868618}, {"level" : 1, "resolution" : 1222.99245256249, "scale" : 4622324.434309}, {"level" : 2, "resolution" : 611.49622628138, "scale" : 2311162.217155}, {"level" : 3, "resolution" : 305.748113140558, "scale" : 1155581.108577}, {"level" : 4, "resolution" : 152.874056570411, "scale" : 577790.554289}, {"level" : 5, "resolution" : 76.4370282850732, "scale" : 288895.277144}, {"level" : 6, "resolution" : 38.2185141425366, "scale" : 144447.638572}, {"level" : 7, "resolution" : 19.1092570712683, "scale" : 72223.819286}, {"level" : 8, "resolution" : 9.55462853563415, "scale" : 36111.909643}, {"level" : 9, "resolution" : 4.77731426794937, "scale" : 18055.954822}, {"level" : 10, "resolution" : 2.38865713397468, "scale" : 9027.977411} ]
This is true, the best approach would be to use zero through whatever to number your levels as you specify them in map.options.lods. I should have done this in the example but did a lazy copy/paste. Here's a better example:lods: [ {"level" : 0, "resolution" : 2445.98490512499, "scale" : 9244648.868618}, {"level" : 1, "resolution" : 1222.99245256249, "scale" : 4622324.434309}, {"level" : 2, "resolution" : 611.49622628138, "scale" : 2311162.217155}, {"level" : 3, "resolution" : 305.748113140558, "scale" : 1155581.108577}, {"level" : 4, "resolution" : 152.874056570411, "scale" : 577790.554289}, {"level" : 5, "resolution" : 76.4370282850732, "scale" : 288895.277144}, {"level" : 6, "resolution" : 38.2185141425366, "scale" : 144447.638572}, {"level" : 7, "resolution" : 19.1092570712683, "scale" : 72223.819286}, {"level" : 8, "resolution" : 9.55462853563415, "scale" : 36111.909643}, {"level" : 9, "resolution" : 4.77731426794937, "scale" : 18055.954822}, {"level" : 10, "resolution" : 2.38865713397468, "scale" : 9027.977411} ]
I don't mean to get the thread of topic, but my concern with the above approach is what happens when we bring in other layers? for example AGO or OSM or a webtiledservice? if you use the {$row}/{$col}/{$lvl} url pattern, and are expecting lvl 10 to be the "universal" definition of 10 based on Google/Bing/ESRI, it causes lots of problems.
It would be really really nice if we could just leave the lods default, not have to define anything, and just say map.maxScale = 16 and map.minScale = 6
Agreed, the current way to do this has issues...
It's like you've been sitting in on our team meetings... I'm not committing to a timeline, but we're planning to add zoom, minZoom, maxZoom, minScale and maxScale properties to map.options to simplify this whole workflow. zoom would be used to specify the zoom level the map starts at, minZoom and maxZoom specify minimum and maxim zoom levels, if that's not obvious ;).