2

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.

2

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.

0

Since you're not setting a basemap, the map doesn't have any zoom levels defined (which are derived from a tiled basemap). You'll want to use the minScale and maxScale properties instead.

Make this change to your sample to see it working

var map = new Map("map", {
  extent: bounds,
  maxScale: 10000000,
  minScale: 100000000
});
  • Thanks ken for your suggestion.Here we don't need extent: bounds, maxScale: 10000000.Only set the min scale value (minScale: 22222225)worked fine. – user3172663 Jun 13 '18 at 5:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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