Select to view content in your preferred language

Function map.getScale() is returning an incorrect scale.

3121
5
Jump to solution
01-15-2016 01:27 PM
VygintasCesnauskas
New Contributor III

I've found an issue where the map scale returned by function map.getScale() is incorrect. Take a look at the screenshot of debug code below:

scaleIssue.png

You can see that I set the scale to a round number of 10,000,000, then in the next line I read the scale back from the map. The scale returned is 9,633,193.199... Any idea why this is happening?

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Vygintas,

   When you use a cached base map there are predefined scales that the map services is cached at and thus when you set the scale to 10000000 it looks for the closest LOD scale for the base map you are using and uses that scale.

View solution in original post

5 Replies
RobertScheitlin__GISP
MVP Emeritus

Vygintas,

   When you use a cached base map there are predefined scales that the map services is cached at and thus when you set the scale to 10000000 it looks for the closest LOD scale for the base map you are using and uses that scale.

VygintasCesnauskas
New Contributor III

Hi Robert,

Thanks for the explanation. The problem is that this is causing issues with map layer visibility. When user selects a scale of 10,000, LOD scale gets set at 10,001 and there is a layer with min scale set at 10,000, this layer will not show up. Hence this being reported as a bug on our side.

Are you aware of any workarounds for this?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Vygintas,

   No Sorry, I have never ran into that situation.

0 Kudos
ReneRubalcava
Frequent Contributor II

The only work around for this I know of, is to not use Tiled Map Services, meaning no basemaps. I've done it before using only a Dynamic service  as my basemap. It's not ideal, but part of how LODs and tiles work.

If you initialize a map without a basemap and then add a Dynamic Map Service, then you're map is not limited to and LODs.

0 Kudos
VygintasCesnauskas
New Contributor III

Thanks Rene, It's good to know that there are options available to get around this issue. For now we will be slightly increasing/decreasing the min/max scales of our data layers to stop them from being hidden.

0 Kudos