Select to view content in your preferred language

CreateLayer is extremely slow for lyr files

523
1
09-25-2018 04:24 AM
MaxMax2
Frequent Contributor

I noticed that LayerFactory.CreateLayer takes huge amount of time to add content of lyr file to a map. On my computer it takes more than 5 minutes to add simple layer (lyr file is attached – TestLayer.lyr).

I created simple test add-in to illustrate the problem (VS solution is attached – TestSlowCreateLayer.zip). Add-in contains the button (named Test slow CreateLayer) which calls

await QueuedTask.Run(() => LayerFactory.Instance.CreateLayer(new Uri(layerFilePath), MapView.Active.Map));

where layerFilePath is the path of attached lyr file (TestLayer.lyr). After method is executed the message box with execution time will be shown.

I can reproduce this behavior for every lyr file I take. Layer data is very simple as you can see.

Also I noticed high CPU usage for ArcGIS Pro while layer is being created: 70-80%.

Environment:

CPU Intel Core i5-7200U

8 GB RAM

ArcGIS Pro 2.1

My add-in should work in ArcgIS Pro 2.1 so I need to get it work good on this version. I suppose 5 minutes for provided lyr file is more than it should be.

Tags (2)
0 Kudos
1 Reply
UmaHarano
Esri Regular Contributor

Hi Max

On my machine I was able to add the layer file using your sample in 28 seconds. So not sure what is happening.  Can you try contacting technical support to see if they can help figure out what is causing this delay on your machine.

Thanks

Uma

0 Kudos