Select to view content in your preferred language

Duplicate Layer Names in TOC in ArcOnline

2030
4
Jump to solution
11-10-2016 09:20 AM
deleted-user-wgzH2d-p_0_f
Deactivated User

I've created a map then subsequently an application with several layers.  When I open the map/app, the TOC appears, and when I expand a layer to see the symbology, it opens to another layer name (typically the same), and then I have to expand again (possibly twice) to see any symbology.  This is very annoying when trying to use the map/app.  See the attachment to see what I'm talking about.  

Any one have an idea how to limit the number of layer names visible?

0 Kudos
1 Solution

Accepted Solutions
KellyGerrow
Esri Alum

Hi Annina,

It looks like you have added a Map Service to your ArcGIS Online web map. When you add a map service, it can possible import multiple layers, so has a label for the name of the service, Bird Conservation Regions, and the layer, BCR.

To only show the layer in the Table of Contents, add the specific layer to the web map instead of the service.

Check out the answer in this post https://community.esri.com/message/591743?sr=search&searchId=25ef8efe-a888-4719-bd31-921b64c9ebe0&se...‌ for an example.

-Kelly 

View solution in original post

4 Replies
KellyGerrow
Esri Alum

Hi Annina,

It looks like you have added a Map Service to your ArcGIS Online web map. When you add a map service, it can possible import multiple layers, so has a label for the name of the service, Bird Conservation Regions, and the layer, BCR.

To only show the layer in the Table of Contents, add the specific layer to the web map instead of the service.

Check out the answer in this post https://community.esri.com/message/591743?sr=search&searchId=25ef8efe-a888-4719-bd31-921b64c9ebe0&se...‌ for an example.

-Kelly 

deleted-user-wgzH2d-p_0_f
Deactivated User

Thanks, Kelly.  I did see that post, but I thought I WAS adding the layer and not a service.  I finally noticed the '0' difference in between the URLs, and it all clicked.

0 Kudos
by Anonymous User
Not applicable

I created a working example like what you have asked Annina Rupe‌ - each one of these layers are actually separate services. SAGIS Property Map Viewer  I made the groups closed but the ones with only one legend symbol, have the symbol line up and no duplicate layer name rows.

I used dynamic layers.  The issue is that ArcGIS Online will not let you add a sublayer as a dynamic map service. This capability will hopefully be added when they release the update enabling grouping layers. When you add a layer with a /0 it adds as a featureLayer but that can be substantially slower than dynamic map image layers, and also may limit the number of features. While that limit can be increased it is usually a good thing to protect the server from overflowing. featureLayers send more data over the wire and use more server resources from my experience.  

For this little demo, I used CSS to effectively accomplish this.  (With Web App Builder Developer)

I remove the sublayer, move the legend symbol up a row, and hide the little > v expander buttons. I also programmatically open some of the rows strategically and also removed a few sublayers with the option to do so in the LayerList configuration. So for example I removed many unuseful things in Traffic layer. Also, made a few layers like Wetlands and LOMAs expanded programmatically so if you expand it, they already are showing their legend. Voila.  This is more a working demo than to go for production, as since it is CSS anything changing the layer list like Add Data will conflict with it. But it shows the usefulness of this as a proof of concept:

SAGIS Property Map Viewer 

I propose Esri consider making LayerList behave more this way or at least easier to configure in this manner, so it looks and feels more like AGS JS TOC to end users. Icing on the cake is when I have enough time to go and make layers auto-expand their legend if they're clicked On (to display, by turning them on with the checkbox). Then it will fully replicate AGS JS TOC, with the exception that clicking a sublayer it won't auto-turn on the parent(s) layers. That I imagine will one day make its way into the layerList logic and if not... my workaround is having all parent layers turned on, or the sublayers on and hiding them like above, so one click, turns them on, by turning on the parent. Again, if this seems confusing, imagine what users are thinking. Mirroring the AGS JS TOC logic and Arc Earth GUI (with partial check boxes) would fix this. I created an idea, if you would like to vote for it!

web app builder layer list - make it like AGS JS TOC 

by Anonymous User
Not applicable

Greetings Kelly Gerrow‌ is there an elegant programmatic way, to hide the top-level name for a service in the WAB layer list?

I stopped the test services in my example to save server resources. What I had made is it "look nice" as a quick demo with CSS but that played havoc on the LL when Add Data added layers.

Basically I want to have each layer as its own service. But I don't want duplicate layer names. And I do not want to add each sublayers to the webmap because then it will be a feature layer, which doesn't work well for many reasons. Is there a way to do this with JS, the API, or WAB? To remove the service name entry in LayerList and Legend and Print?

0 Kudos