How does one remove a feature layer?

216
2
Jump to solution
10-28-2021 02:37 PM
RogerAsbury
New Contributor II

I fear this is a super basic question, but I have not found an actual answer on line... If a user of a project in ArcGIS Pro wants to remove a layer, they simply right-click it and select "Remove" from the resulting menu. I'm curious how one would accomplish the same thing programmatically.

To create a layer you can simply do something like: FeatureLayer featLayer = LayerFactory.Instance.CreateFeatureLayer(params);

Is there an opposite equivalent of this? A RemoveFeatureLayer(params)? I can't seem to find anything for this. 

 

0 Kudos
1 Solution

Accepted Solutions
UmaHarano
Esri Regular Contributor

Hi,

The RemoveLayer method on the Map will accomplish this.

MapView.Active.Map.RemoveLayer(layerToRemove);

 

View solution in original post

2 Replies
UmaHarano
Esri Regular Contributor

Hi,

The RemoveLayer method on the Map will accomplish this.

MapView.Active.Map.RemoveLayer(layerToRemove);

 

RogerAsbury
New Contributor II

Thank you very much! Not sure how I missed that. :)

0 Kudos