sublayers minScale and maxScale Issue

1512
4
Jump to solution
06-17-2019 07:48 PM
ToddFagin
Occasional Contributor II

I wish to have certain sublayers of a dynamic layer render at scales different from those in the layer properties. I can get the minScale and maxScale to work with one layer, but (for some reason), not another. The one on which it isn't working has cached tiles and I speculate that is the issue, but I honestly have no idea.

Here's the example that works:

var cities = new MapImageLayer({
          url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer",
          sublayers: [
            {
              id: 0,
              minScale: 5000000,
              maxScale: 24000
            }
          ]
        });

Here's the one that isn't working (truncated for ease). The minscale is set at a ridiculous number at the moment because I was trying to get it to render no matter how far zoomed out:

var transportation = new MapImageLayer({
          url: "https://tigerweb.geo.census.gov/arcgis/rest/services/TIGERweb/Transportation/MapServer",
          sublayers: [{
            id: 8,
            minScale: 10000000,
            maxScale:  1001
          },{
            id: 9,
            minScale: 10000000,
            maxScale:  1001
          }]
                
        });
       

Any insight would be greatly appreciated.

Thank you.

0 Kudos
1 Solution

Accepted Solutions
Egge-Jan_Pollé
MVP Regular Contributor

Hi Todd Fagin,

The explanation is quite straightforward, I think.

Your cities layer (i.e. the example that works) comes from this sample server USA (MapServer) and has no visibility range set. Both Min Scale and Max Scale are set to 0 ("minScale": 0, "maxScale": 0), thus allowing you to set these values in your JavaScript application.

The TIGERweb/Transportation data comes from this server TIGERweb/Transportation (MapServer) and as you can see each and every layer has it's own visibility range set. The different road types (Primary, Secondary and Local Roads) are even offered multiple times, for different visibility ranges. And in this case your options to manipulate (or set) the visibility are much more limited. (Of course you can limit the visibility within it's visibility range, but you cannot extend it outside this range.) So, even though your JavaScript code says the layer should be visible, the TIGERweb server will not return anything to show...

I would suggest to add the TIGERweb/Transportation data as a TileLayer instead, like this:

var transportation = new TileLayer({
  url: "https://tigerweb.geo.census.gov/arcgis/rest/services/TIGERweb/Transportation/MapServer"
});

 

In this way all layers will be added to the map and and automatically adhere to the visibility range settings on the server.

Hope this helps to solve your issue.

Cheers,

Egge-Jan 

View solution in original post

4 Replies
Egge-Jan_Pollé
MVP Regular Contributor

Hi Todd Fagin,

The explanation is quite straightforward, I think.

Your cities layer (i.e. the example that works) comes from this sample server USA (MapServer) and has no visibility range set. Both Min Scale and Max Scale are set to 0 ("minScale": 0, "maxScale": 0), thus allowing you to set these values in your JavaScript application.

The TIGERweb/Transportation data comes from this server TIGERweb/Transportation (MapServer) and as you can see each and every layer has it's own visibility range set. The different road types (Primary, Secondary and Local Roads) are even offered multiple times, for different visibility ranges. And in this case your options to manipulate (or set) the visibility are much more limited. (Of course you can limit the visibility within it's visibility range, but you cannot extend it outside this range.) So, even though your JavaScript code says the layer should be visible, the TIGERweb server will not return anything to show...

I would suggest to add the TIGERweb/Transportation data as a TileLayer instead, like this:

var transportation = new TileLayer({
  url: "https://tigerweb.geo.census.gov/arcgis/rest/services/TIGERweb/Transportation/MapServer"
});

 

In this way all layers will be added to the map and and automatically adhere to the visibility range settings on the server.

Hope this helps to solve your issue.

Cheers,

Egge-Jan 

ToddFagin
Occasional Contributor II

That makes sense. I was under the (false) impression that I would be able to completely override the min and max scales.

For my purposes, though, the tile layers won't work. I need the local roads to turn on sooner than they currently do. This means I am either going to have to try to find another source or create my own service (which I was absolutely trying to avoid).

Thanks for your reply.

0 Kudos
Egge-Jan_Pollé
MVP Regular Contributor

Hi Todd Fagin,

You might have a look in the Living Atlas of the World. There is a dataset (in the Exclusive content for subscribers) called USA Roads. This Map Image Layer by Esri displays roads from 2014 U.S. Census TIGER dataset. Maybe this will suit your needs?

BTW - If you think your original question has been answered, you might mark it as such. In this way we help the Esri Community to find correct answers.

Cheers,

Egge-Jan

ToddFagin
Occasional Contributor II

Done. And I will look into the Living Atlas of the World.