AnsweredAssumed Answered

CreateLayer is extremely slow for lyr files

Question asked by maxmaxmaxmaxmax on Sep 25, 2018
Latest reply on Oct 17, 2018 by UHarano-esristaff

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.

Attachments

Outcomes