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.

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Jun 12, 2018 at 10:07

2 Answers 2

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.

answered Jun 12, 2018 at 13:14
0
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
});
answered Jun 12, 2018 at 13:04
1
  • Thanks ken for your suggestion.Here we don't need extent: bounds, maxScale: 10000000.Only set the min scale value (minScale: 22222225)worked fine. Commented Jun 13, 2018 at 5:08

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.