Can a specific map scale be set?

694
2
05-31-2020 05:14 PM
PeterLen
Occasional Contributor

Say I have a basemap that has 15 zoom levels where zoom level 18 has a map scale of 1:2287 and zoom level 17 has a map scale of 1:4514.  Is it somehow possible to set the map extent to what it would look like at a scale of 1:3000?  I have a situation where 1:2287 zooms me in too close and 1:4514 is a bit too far out.  I would like to see the view at a scale of 1:3000, which would be just about right.  I have a feeling that the scale can only be set to the nearest zoom level that  the current map is set for and if I want to get to a scale of 1:3000, I just need to find a map that has been set to use a zoom level at that scale.  I am not in a position to actually reset the levels, such as what is listed in the Set visible scales | ArcGIS API for JavaScript 3.32 , however.  Just wondering if it were possible.

Thanks for any thoughts - Peter

0 Kudos
2 Replies
ChristianBischof
Esri Contributor

for development purposes I like to declare the var view; outside of the require statements so I can get and set the view's properties in the browsers developer tools.

Maybe this can help you out. For your particular case I'd do: view.scale = 3000 in the dev tools of the browser and see if it fits my needs.

0 Kudos
TheodorosKelekis
New Contributor

You need to set the Constraints.snapToZoom property. to false

In MapView, snapToZoom is true by default.