ArcGIS JavaScript API – Setting Minimum Zoom without Base Map

arcgis-javascript-apizoom

How do I set min zoom for map without defining base map(User can't zoom out beyond that label)?

Set min zoom with base map is working fine.

For example:

map = new Map("map", {
                        basemap : "streets",
                        center : [ 78.00, 21.00 ],
                        sliderPosition : "top-right",
                        maxZoom : 10,
                        minZoom: 5,                             
                    });

But when i am trying minZoom without base map, it's not working

basemap : ""

My main motive is use the min zoom option without base map.

Something like this in the ArcGIS API for JavaScript Sandbox.

Best Answer

You can set minScale instead. The layer in your example has a Min Scale of 500000000, so you could set the the map's minScale to a smaller value which will disable zooming out beyond that scale.

map = new Map("map", {                            
    center : [ 78.00, 21.00 ],
    sliderPosition : "top-right",
    minScale: 490000000                       
});

You will notice when you don't have a basemap, the map's zoom property is -1, since the zoom value corresponds to the various levels of the basemap. However, the map's scale value increases when you zoom out, and decreases when you zoom in.

Related Question