Multiple LayerLists In Web App Cause Slowness

1896
12
Jump to solution
10-04-2019 07:22 AM
RichardRhone
New Contributor III

I have close to 50 layers in my web app. I thought, for easier access and aesthetics, i would employ multiple layerlists. However, this has made the map extremely slow. It takes upwards of 20 seconds to zoom each extent. I presume that since I have 5 layerlist with filtered layers, this essentially equates to 250 layers? How do I improve performance of the map without losing the multiple layerlists?

0 Kudos
1 Solution

Accepted Solutions
RichardRhone
New Contributor III

So finally i get this thing to work! The layerList with Legend was causing the slowness. Apparently, there is a bug or something that cause the slowness once you exceed a certain number of layers. I added a normal layerList widget and a legend wdget and the slowness was significantly reduced 

View solution in original post

0 Kudos
12 Replies
MattDriscoll
Esri Contributor

Hi Richard,

What version of the API are you seeing this? I'd like to see if I can trace what is causing the slowness. If you have 50 layers with 5 LayerList widgets you shouldn't be seeing a slowdown like that.

-Matt

0 Kudos
RichardRhone
New Contributor III

hi Matt,

Im using 4.12

0 Kudos
MattDriscoll
Esri Contributor

Thanks Richard Rhone‌. Can you try using `4.13` which is not yet released but the URL is available. I'm wondering if its still an issue. If it is, i'll create an example using a bunch of layers and multiple LayerLists to test with.

0 Kudos
RichardRhone
New Contributor III

Hi Matt,

4.13 is actually worse: 

4.12 averages out at 18 secs

4.13 averages out at 24 secs

0 Kudos
MattDriscoll
Esri Contributor

Richard Rhone‌ how are you filtering the layers for each LayerList? 

- Are you filtering them using layer.listMode?

- Are you using `listItemCreatedFunction` to filter them?

- Some other way?

0 Kudos
RichardRhone
New Contributor III

Matt...

They are filtered using the example here : https://community.esri.com/thread/239738-multiple-layerlists-in-web-app 

0 Kudos
KristianEkenes
Esri Regular Contributor

Hi Richard,

I don't think we considered having multiple LayerLists in the same app during the design of the widget. Would using GroupLayers help with the ease of use for maps with lots of layers? You can add layers as sublayers to a GroupLayer, which can be expanded or collapsed for ease of use. The visibilityMode and listMode properties will help in that approach. listMode will control whether a layer's list item is visible in the LayerList or if the children layers of a GroupLayer will be visible. visibilityMode allows you to control how layer visibility can be toggled - either allowing one layer to be visible at a time within the group or if any combination of layers can be toggled on or off.

RichardRhone
New Contributor III

Hi Kristian,

I have used group layers :

/ADD TRANSPORTATION NETWORK GROUP LAYER
var transportationNetworkGroupLayer = new GroupLayer({
title: "Transportation Network", visible: true, visibilityMode: "independent", layers: [otherRoadsLayer, townRoadsLayer, classCRoadsLayer, classBRoadsLayer, classARoadsLayer, highwayLayer, railwayLinesLayer] });
map.add(transportationNetworkGroupLayer);

However,  there are still alot of layers to show in one layerList.  The thought was to have multiple layerlists for easier access and aesthetics. 

0 Kudos
RichardRhone
New Contributor III

So... I found that the map itself is slow. I have one version with 15 layers and another with 54 layers.

The 15 layer version zooms to extents in less than 1/2 sec. The 50+ layer one zooms in 4 secs. This suggests that its not necessarily the multiple layerlists that are problematic. Is there a limit on the number of layers?

0 Kudos