Select to view content in your preferred language

visibility control for layers in cached service

5764
8
Jump to solution
09-23-2014 02:21 AM
PaulLohr
Frequent Contributor

Adding a cached service to an ArcGIS Online map results in not being able to control the visibility of individual layers. The entire service can be turned on or off. With a dynamic map service, I can turn layers on and off as needed.

Is there a way to add a cached service to ArcGIS Online so that I can control the visibility of layers within that service?

I am talking about a service coming from our ArcGIS Server instance and not a service hosted by ArcGIS Online.

Thank you for any help,

Paul Lohr

______________

GeoNet stinks. Please bring back the old arcgis forums.

1 Solution

Accepted Solutions
MikeMinami
Esri Notable Contributor

ArcGIS Server cached map services can support accessing individual layer of the service via an index number. Like Anthony says, in this case you are bypassing the cache. Instead, ArcGIS Online map viewer sends a query to the server to retrieve the feature geometry (all the coordinate data) and draw the data client side (e.g., in the web browser). You have to be careful with this approach to adding layers because the client has limits on the number of features it can handle (we suggest less than 1000). This post discusses the limitation of client side drawing of features.

https://community.esri.com/message/270979#270979

ArcGIS Online Hosted tile layers do not support accessing the individual layers. Tile services can only return tiles from the cache.

Thanks,

Mike

View solution in original post

0 Kudos
8 Replies
AnthonyGiles
Honored Contributor

When you create a cache you are essentially flattening your layers into a single png tile, so there is no way turning on and off individual layers once the cache is created. To maintain the ability to turn layers on and off you will need to create a separate cache for each layer. Overlays with need to be cached as .png to maintain the transparent background.

0 Kudos
PaulLohr
Frequent Contributor

Are you sure about this, Anthony? You may want to look at the REST endpoint of a cached map service that has more than one layer. Copy / paste a layer's REST endpoint into an ArcGIS Online map adds only that layer.

If the creation of a cache for a map service flattened layers into a single image tile, I would not be able to add one layer from a service to an ArcGIS Online map. I have tested this with 10.01 and 10.2.2.

Paste the link below into an ArcGIS Online map then change the symbol so the polygons are visible. The issue with the symbol has nothing to do with the discussion. Pretty sure this is a cached layer.

http://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/3

Best I can tell, cached map services are not worth using because ArcGIS Online does not offer visibility control for each layer. ArcGIS Server delivers the layers separately, but ArcGIS Online does not take advantage of this. The workaround to this is probably obvious but requires a lot of effort.

0 Kudos
AnthonyGiles
Honored Contributor

Paul,

what you are adding in there is a single layer of a dynamic map service not the complete service which is cached.

0 Kudos
MikeMinami
Esri Notable Contributor

ArcGIS Server cached map services can support accessing individual layer of the service via an index number. Like Anthony says, in this case you are bypassing the cache. Instead, ArcGIS Online map viewer sends a query to the server to retrieve the feature geometry (all the coordinate data) and draw the data client side (e.g., in the web browser). You have to be careful with this approach to adding layers because the client has limits on the number of features it can handle (we suggest less than 1000). This post discusses the limitation of client side drawing of features.

https://community.esri.com/message/270979#270979

ArcGIS Online Hosted tile layers do not support accessing the individual layers. Tile services can only return tiles from the cache.

Thanks,

Mike

0 Kudos
PaulLohr
Frequent Contributor

Thank you for your help, gentlemen.

Another user has marked this question as answered correctly. He did not post the question. I am not liking this new GeoNet system.

For passers by, here is the summary of answers.

I am pretty sure the bottom line is that layer-level visibility control is not available in ArcGIS Online under these conditions: when using a cached service, and connecting to that service at the service's uppermost level. Whether coming from a hosted service or an in-house ArcGIS Server instance, there is no layer-level visibility control if the service is delivered as a cache. If one connects to a layer of a service rather than the entire service, visibility control is available.

If you access a cached web service at this level, cached tiles are returned.

http://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/

If you access a cached web service at this level, a dynamic map service is returned.

http://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/3

Can someone please point out where the above two statements are covered in documentation?

0 Kudos
MikeMinami
Esri Notable Contributor

There's probably not one single documentation location that explains everything you want to know, but here are some links:

Information about hosted feature and tile layers

About hosted features and tiles—Help | ArcGIS

Feature layers support vector feature querying, visualization, and editing. Feature layers are most appropriate for visualizing data on top of your basemaps. In web apps, feature layers are drawn by the browser and support interactive highlighting, queries, and pop-ups.

Tile layers support fast map visualization using a collection of predrawn map images, or tiles. These tiles are created and stored on the server after you upload your data. Tiled layers are appropriate for basemaps that give your maps geographic context.

About ArcGIS Server web services

ArcGIS Server web services—Help | ArcGIS

ArcGIS Help (10.2, 10.2.1, and 10.2.2)

The thing to remember is that different layer types support different capabilities. If you want super fast drawing, tile layers are the way to go. But you can't turn on/off individual layers.

The fact that arcGIS online can access an individual layer of an ArcGIS Server map service is a feature specific to ArcGIS Online. When you work with a layer like this, you are not accessing a dynamic map service, rather, you are completely bypassing the drawing capabilities of the server. What's happening is that the client (web browser, mobile app) is requesting the geometry (xy coordinates) of the features and drawing them as best it can. Most clients can't handle the complex symbology supported by the server. So, for example, if you have a road layer with complex line symbols that represent different types of roads, likely they would likely be drawn with simple colored lines. The post I added above which points to other forum posts attempt to explain the details.  Also, accessing the layer via it's index is slower than accessing the tiles.

In general, I think ArcGIS Online requires that people rethink how they share out their data through web services on ArcGIS Server. In the past, you'd put all your layers into one service and make an application that used that service. Often, there was a one to one relationship between a web service and an application. Since there were only dynamic map services, there was never an issue about turning layers on and off. However, these weren't always the fastest to display.

Over time, people wanted faster display, like they saw in google maps. Well, google caches their maps as tiles and we enhanced the map service to support tiles. The nature of tiles is that they draw fast because the server has predrawn all tiles and when a request comes in, the set of tiles is returned. It's very fast, but since it's predrawn, you can't turn layers on/off.

So now, we advise people to think about how their layers will be used and organize them into services appropriately. In this way, services are more like data that are used in multiple maps. For layers that don't change frequently and are meant more as background information, like a basemap, you'd put them together and cache them. For layers that change frequently and are used independently across many maps, you'd make dynamic map services. We refer to these types of layers as operational layers. Whether you put more than one operational layer in a service depends on how you want to use it. If you want to use in separately, you'd put it in its own service.

Hope this helps,

Mike

AnitaPalmer1
Frequent Contributor

Mike,

Thanks so much for this. I have published hundreds of feature services and tile maps for the curriculum resources I work on and can obviously accomplish the task.  I THANK you for giving me some more tools to not only get those services up on AGO but rather to create efficient and speedy services. The opportunity to be able to get into the brains of the amazing Esri programmers and staff is phenomenal and will expedite my work tremendously.

Love GeoNet!

Anita Palmer

0 Kudos
JenniferMcCall4
Frequent Contributor

Hi Paul,

Directly from the ArcGIS resources page:

"The REST API Map Service resource works only with the default data frame of your published map document. This resource provides basic information about the map, including the layers that it contains, whether or not the map is cached."

ArcGIS REST API

Hope this helps!

0 Kudos