I know you can use this method for creating a group layer:
LayerFactory.Instance.CreateGroupLayer(map, 0, "mygrouplayer");
This seems to instantly create a group layer in the map, but, is there a way to create a group layer without it being instantly created and then add it in later?, i.e. create it in memory first.
Solved! Go to Solution.
The links should work now. I have edited the typos.
Also, in the ProSnippets: Map Authoring page there are 3 code snippets that use the LayerDocument to configure Feature Layers prior to adding it to the map. They create FeatureLayers, but the concept to create Group Layers is similar.
Thanks
Have you considered creating a CIMGroupLayer, populating it with what you need, then turning it into a layer by calling CreateGroupLayer followed by GroupLayer.SetDefinition ?
Not in the slightest - wasn't aware of that at all - but I will have a dig around on what you describe.
Thanks Kirk.
Hi Simon
LayerDocument class allows you to configure a layer's properties prior to adding it to the map. You can either create a new LayerDocument (using the available constructors) from an existing lyrx file or an existing feature layer in a map. Note: You also have the option of creating a blank LayerDocument and configuring all the properties from scratch if you want. But this is rare.
You can then use the configured LayerDocument and Create a layer (or Group Layer) using the CreateLayer method. The specific overload you will need is this:
https://pro.arcgis.com/en/pro-app/sdk/api-reference/index.html#topic26527.html
I will post a snippet on how to do this if you need further help with this.
Thanks
Uma
Hi
The link https://pro.arcgis.com/en/pro-app/sdk/api-reference/index.html#topic26527.html
doesn't seem to work - I get the following in the browser:
The link seems to be different
Your link as shown
https://pro.arcgis.com/en/pro-app/sdk/api-reference/index.html#topic26527.html
Where it links to
" https://prodev.arcgis.com/en/pro-app/sdk/api-reference/index.html#topic26527.html "
when you examine its link versus the text.
Try editing the link to see if that is the issue
The links should work now. I have edited the typos.
Also, in the ProSnippets: Map Authoring page there are 3 code snippets that use the LayerDocument to configure Feature Layers prior to adding it to the map. They create FeatureLayers, but the concept to create Group Layers is similar.
Thanks