Reinstate ArcGIS.Desktop.Mapping.LayerPosition enum

627
4
04-04-2023 11:13 PM
Status: Open
Labels (1)
StefanDieters1
New Contributor III

In the transition from ArcGIS Pro 2.9 to Pro 3 the ArcGIS.Desktop.Mapping.LayerPosition was removed i.e.

see https://pro.arcgis.com/en/pro-app/3.0/sdk/api-reference/topic15120.html

https://pro.arcgis.com/en/pro-app/3.0/sdk/api-reference/topic15120.html#i-heading--detailed-list-of-...

look in API Changes Detailed List of Changes ArcGIS-Core 15th instance of 29 for LayerPosition.

The LayerPosition.AutoArrange option was very handy for adding external basemaps to a map. It would group basemaps together at the bottom of the Table Of Contents.

As in this useage:

layer = await QueuedTask.Run(() => LayerFactory.Instance.CreateLayer(uri, mapView.Map, LayerPosition.AddToTop, ShowName));

Alternative create an equivalent method or enum with the same functionality as the AutoArrage option.

Tags (1)
4 Comments
TanuHoque

@StefanDieters1 

It got moved to MapMemberCreationParams class. Please use the MapMemberPosition property of this class for this.

Please let me know if it doesn't work for you.

Thanks

 

 

KoryKramer
Status changed to: Needs Clarification
 
StefanDieters1

Thanks @TanuHoque

that was the clue I need to convert my code across.

For anybody else that needs help here is a code snippet:

                        // Create the parameters
                        // note many more parameters are possible
                        // Use this pattern to create Feature layers, service layers ...
                        var parmeters = new LayerCreationParams(uri)
                        {
                            Name = ShowName,
                            MapMemberPosition = MapMemberPosition.AutoArrange,
                            IsVisible= true,                            
                        };
                        
                        // Layers such as the world toppgraphic and basemaps added via Layer > Basmap > select from gallery are not feature layers.
                        layer = await QueuedTask.Run(() => LayerFactory.Instance.CreateLayer<Layer>(parmeters, mapView.Map));

uri is the Uri(Path to the service providing the basemap) e.g. https://services.thelist.tas.gov.au/arcgis/rest/services/Basemaps/Topographic/MapServer

ShowName is a string describing the layer.

If people are interested in getting the index themselves: this link was useful:

/ https://community.esri.com/t5/arcgis-pro-sdk-questions/c-arcgis-pro-sdk-move-layer-b-in-contents-ben...

KoryKramer
Status changed to: Already Offered