POST
|
Thanks again. This is the only way for me to keep the legend in the layerlist. I'm using Esri's sample for that which seems very simple until you dig into it. It actually creates a separate legend widget for each layer in the map, within the layerlist created function. I have dozens of layers in my map, so when the function runs over and over again it kills my performance. No legend at all is best but this helps tremendously. I can't understand how esri has programmed this function like this on purpose.
... View more
05-12-2021
02:51 PM
|
0
|
0
|
2668
|
POST
|
Super, thanks for the explanation. I get it now. So it essentially just runs once. Does this still improve performance?
... View more
05-12-2021
01:49 PM
|
0
|
2
|
2670
|
POST
|
It seems this problem might be worse in 4.19. I just upgraded and my map which was working okay is now barely functional. I've pinpointed it to the listItemCreatedFunction and specifically adding a legend to the content panel. If I disable that part peformance is great. The function still gets called repeatedly but it's not a performance issue. @Andy_Morgan can you explain how your array works above? I'm not quite following it. Thanks!
... View more
05-12-2021
11:44 AM
|
0
|
1
|
2676
|
POST
|
Any update on this? I believe the issue is more pronounced in the 4.19 release. I create a legend in the item panel of the layerlist with the list item created function. I have multiple layers in my map and the performance is terrible. As soon as I disable the legend the performance increases. Sketch and measure tools work better too.
... View more
05-12-2021
11:37 AM
|
0
|
0
|
706
|
POST
|
Thanks very much for your example. However, the field in the service from your example is actually of type GlobalID and not Guid. GlobalID (type: esriFieldTypeGlobalID, alias: GlobalID, SQL Type: sqlTypeOther, length: 38, nullable: false, editable: false) The field that I'm trying to show is of type Guid: type: esriFieldTypeGUID
... View more
05-11-2021
10:45 AM
|
0
|
0
|
538
|
POST
|
I'm using the JavaScript API version 4.18. I'm building a popup on a layer that has a GUID field that I want to display. The field does not display weather I use defaultPopupEnabled = true or if I create my own template for the layer. I've found this in the CreatePopupTemplateOptions documentation ("System fields such as Shape_Area and Shape_length, in addition to geometry, blob, raster, guid and xml field types are automatically ignored"): https://developers.arcgis.com/javascript/latest/api-reference/esri-support-popupUtils.html#CreatePopupTemplateOptions Is there anyway to display a GUID field in a popup?
... View more
05-05-2021
09:21 AM
|
0
|
2
|
622
|
POST
|
Hello, did you ever find a solution to this? I'm having the exact same problem. I have a WMS with a sublayer. If I don't add any customParameters the legendUrl works fine. But when I add a TIME parameter it appends that parameter to the legendUrl with a ? instead of & and the url does not work.
... View more
04-21-2021
09:39 AM
|
0
|
2
|
1132
|
POST
|
Hey @AndrewMurdoch1 I've made some progress on the memory leak in my app. I've successfully gotten the view to completely destroy. When the user goes back to the map component it displays the existing map view and there is only one object in the memory snapshot. On ngOnDestroy I had to destroy, remove, and nullify everything that contains any reference to the map view. For widgets I run destroy() and make null. Some objects besides widgets retain a reference to the view somehow also. I create a PortalBasemapSource and even though there is no reference to the view I had to destroy and make it null also. I think anything in the API that you create with the new keyword should be destroyed and made null. I also created and event handler for every event (.on(...)) I've created on the view, widgets, and watchUtils. Then in ngOnDestroy I call remove() on all the handlers. It was a brutal effort of trial and error but in this case I've got it working. I guess this makes sense. I think the api is doing what it is supposed to. I think it's more of an issue with angular/javascript garbage collection. Not sure how many things you have going on in your map but if you can destroy them or remove them onDestroy than you may be able to fix your memory leak. As an extra tidbit I'm using the Angular Material Drag and Drop Directive (https://material.angular.io/cdk/drag-drop/overview). At version 8.2.3 it has a memory leak in the dragboundary property (https://github.com/angular/components/issues/17255). Took me a while to figure that out since I'm putting my widgets in a div that the user can drag around. You might check that too, if you are using it. Good luck!
... View more
03-19-2021
02:50 PM
|
1
|
4
|
2018
|
POST
|
Thanks Andrew, at least I know I'm not crazy. I only really determined it was a problem because I noticed each time the user went back to the map the performance of the map was degraded. Also, if I repeatedly test going back and forth to the map eventually (~10-15 visits) I get a webGL error (number of webGL contexts has reached it's limit, the last context will be lost). So it's not just that the map view is kept in memory but there is a webGL context for each map view. Another very odd thing I noticed is I have an identify task and I walked through the code for when you click the map. The identify task gets called once for each map component I built. So if I have gone back to my map page three times the identify task gets called three times for each click. So it seems the 'old' map views don't actually go away. They still have a webGL context and are still there even though you don't see them in the DOM. Any ideas on how to communicate this to esri? It seems like it should be something on their end and we shouldn't be jumping through hoops to try and fix this.
... View more
03-18-2021
08:38 AM
|
0
|
1
|
2024
|
POST
|
Thanks Andrew, I just saw your other post communicating with Andy Gup. I've been communicating with him too. In my case refreshing the page is not exactly what I want to do. I have successfully created a service to build the map view. When a user navigates to the map page they should get a a new map view if it's their first time or the existing one from the service if they are returning there. I have a github repo doing this that you can check out. https://github.com/nbabel/MapView-service In this repo it works and there is not a memory leak. That is, the map component gets flushed properly on ngOnDestroy. However, this is just a sample that doesn't really do much. In my full application I have many layers, graphics, widgets, popups, etc. Even though I'm using the service the same exact way it doesn't flush the previous map view properly. I think there must be something I've created that holds on to the view or the DOM node. I'm going through the painful process of trying to determine that now. Do you have additional items (widgets, layers, etc.) in your view?
... View more
03-18-2021
06:58 AM
|
1
|
4
|
2049
|
POST
|
Hi @AndrewMurdoch1 did you ever find a solution to this? I think I'm running into the same exact problem.
... View more
03-18-2021
06:31 AM
|
0
|
6
|
2059
|
POST
|
I'm working with the ArcGIS JavaScript API 4.18 'Add a Legend to LayerList' sample (https://developers.arcgis.com/javascript/latest/sample-code/widgets-layerlist-legend/). I have group layers and sub group layers in my map and the sample code has a line in it to check for group layers so it doesn't show the legend twice. This all works fine until you make selectionEnabled = true. This lets you select layers and drag them to reorder them in your list. Layers with one group can be reordered without issue. However, layers in a subgroup (group within a group) lose the legend, and any other actions, you have set on the layer when you reorder them. If you drag them out of the subgroup the legend and actions will reappear. This is happening because the listItemCreatedFunction gets called when you reorder the layers but the flag that checks if the layer is a group prevents the layers in the subgroup from building a legend. You can see an example in these two pens: In this first example there is only one group and you can reorder the layers without issue https://codepen.io/nbabel/pen/abBwLNJ In this second example there is a subgroup and if you reorder the layers within the subgroup the legend disappears. If you drag a layer out of the second group the legend reappears https://codepen.io/nbabel/pen/ExgNMwO So my question is: Is this expected behaviour? Is this a bug? When I'm reordering the layer why does it apparently think it's a group layer and not build a legend? Thanks for any help
... View more
02-18-2021
09:13 AM
|
0
|
0
|
909
|
POST
|
Any update on this? I am having the same isues. I have a layerlist widget with embedded legend. I have many layers in my map. When the view loads the listItemCreatedFunction gets called over 1000 times. I don't have that many layers in my map. It also gets called by other widgets. I have the sketch widget in my map and the listItemCreatedFunction gets called on every layer multiple times every time I click a point with the sketch tool. Apparently this happens with the select tool and measure tool as well (https://community.esri.com/t5/arcgis-api-for-javascript/problem-sketchviewmodel-create-fires-legend-update/td-p/78035). @_____ why does the listItemCreatedFunction get called so frequently? It is killing our apps.
... View more
01-21-2021
07:17 AM
|
1
|
1
|
2903
|
POST
|
Any update on this? I believe I'm having the exact same problem.
... View more
01-20-2021
02:56 PM
|
0
|
1
|
814
|
POST
|
Did you ever log a bug with Esri on this? This seems to still be an issue at 4.17. Although, I wonder if it is a bug or a flaw in the logic. When creating a new IdentifyTask you just specify a url. It isn't really tied to the layer at all. So how would it know if the layer is visible or not? It seems like we are missing something.
... View more
12-31-2020
09:23 AM
|
0
|
0
|
542
|
Title | Kudos | Posted |
---|---|---|
1 | 02-18-2022 04:05 PM | |
1 | 07-21-2021 07:32 AM | |
1 | 07-20-2021 08:08 AM | |
1 | 06-10-2021 02:48 PM | |
1 | 11-05-2020 07:14 AM |
Online Status |
Offline
|
Date Last Visited |
12-13-2023
03:57 PM
|