We deliver web apps for our customer based on common platform which in turn is developed on top of ArcGIS JS API 3. Customers publish their map layers to get whatever maps they need.

Customers have controls to enter "exact" scale to zoom map on the screen and also they have Print function where they enter wanted scale. These scales typically are "nice round numbers" like 1000, 5000, 25000, etc.

The issue they have (and thus we have) is when they publish map layers using either minScale or maxScale where minScale/maxScale are "nice", too. At these scales visibility of layers is undetermined. Sometimes they are visible and sometimes not.

The issue lays in math. When projected on fixed number pixel grid (either on screen or on paper) it's not possible to get scale "nice" due to math calculations in projection. Say if map.setScale(5000) is called then actual scale may be something like 5000.000000056016 or 4999.99999995425, it will also depend on what x-y pixel grid of the map on the screen will be. If some layer has min or max scale 5000, it's a random luck if it will be displayed or not.

To demo it, here is live app: https://codepen.io/anon/pen/wrXyKL

My questions are: How would you handle such situation? Is it issue with esri JS API or it's by design? Are there guidelines for proper setting of minScale/maxScale when publishing maps?

Update 2017-10-16. Esri support logged a bug for this case: BUG-000108793 - setScale does not zoom exactly to the given scale.

Update 2018-01-15. Status of BUG-000108793: Not in Current Product Plan. Public Explanation: No plans for implementing this.

Your Answer

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

Browse other questions tagged or ask your own question.