Limitations for LayerCreationParams Fixed?

1569
9
Jump to solution
04-21-2020 09:40 AM
Vidar
by
Occasional Contributor II

Hi 

Have the limitations for LayerCreationParams been fixed for 2.5 or greater? I really need to change visibility for layers and set definitions too.

See this link if you are unsure what I'm talking about (bit where it mentions KNOWN LIMIT):

https://github.com/esri/arcgis-pro-sdk/wiki/ProConcepts-Map-Authoring#layer-files-and-layer-packages 

Kind regards.

0 Kudos
1 Solution

Accepted Solutions
UmaHarano
Esri Regular Contributor

Hi,

I can confirm that the ability to create a Layer Document from a Lyrx file saved on Portal has been added to 2.8.  2.8 is currently under development.

ArcPro 2.8 will be released later this year.

Thanks!

Uma

View solution in original post

9 Replies
UmaHarano
Esri Regular Contributor

Hi Simon

This limitation still exists. The Pro development team is looking at fixes.

In the meantime, you can access the LayerDocument and the CIM Definition to accomplish what you need -

      // create a layer and add it to a groupLayer
      string urlLyrx = @"\\path\States.lyrx";
      QueuedTask.Run( () => {

        var layerDoc = new LayerDocument(urlLyrx);
        var cimlyrDoc = layerDoc.GetCIMLayerDocument();
        var defn = cimlyrDoc.LayerDefinitions[0] as CIMFeatureLayer;
        defn.Visibility = false;
        defn.Name = "Test Layer";
        //defn.Renderer = ..
        //defn.DisplayFilters = 
        //etc

        var createParams = new LayerCreationParams(cimlyrDoc);
        FeatureLayer flyr = LayerFactory.Instance.CreateLayer<FeatureLayer>(createParams, MapView.Active.Map);
      });‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Thanks

Uma

0 Kudos
Vidar
by
Occasional Contributor II

Hi Uma,

I've tried :

var layerDoc = new LayerDocument(portalItemUrl);

with the portal item (which is a .lyrx file) and it returns null.  Is there any way to make the code that you outlined in your answer work with portal layer items?

Kind regards.

0 Kudos
Vidar
by
Occasional Contributor II

The example looks like it only works with physical layer files on disk - however I am working with layer files from the portal and they com back as type Core.Item. Does this work with portal layer items? and can I position/set the index of the layer in the contents? like I can with the one of the overrides on the CreateLayer().

0 Kudos
UmaHarano
Esri Regular Contributor

Hi Simon

Looks like the portal item URL cannot be passed to the Layer Document at this time.  

We will prioritize adding this requirement for a future near term release.

Thanks!

Uma

Vidar
by
Occasional Contributor II

Hi Uma, 

Thanks for getting back to me. This is disappointing for us, I really do hope ESRI fix this sooner rather than later as it is hampering and degrading the user experience for our add in.

Anyway fingers crossed.

Kind regards

Simon.

UmaHarano
Esri Regular Contributor

Hi Simon,

These LayerDocument issues have been reported to the development team. We will prioritize adding these requirements for a future near term release.

Thank you for all your feedback!

Uma

Vidar
by
Occasional Contributor II

Did this get fixed in 2.7 - I don't see the text about "KNOWN LIMITS"?

0 Kudos
RichardHowe
Occasional Contributor III

@UmaHarano Is there any update on this?

0 Kudos
UmaHarano
Esri Regular Contributor

Hi,

I can confirm that the ability to create a Layer Document from a Lyrx file saved on Portal has been added to 2.8.  2.8 is currently under development.

ArcPro 2.8 will be released later this year.

Thanks!

Uma