Select to view content in your preferred language

How does one remove a feature layer?

1894
2
Jump to solution
10-28-2021 02:37 PM
RogerAsbury
Frequent Contributor

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. 

 

--
Roger Asbury
Analyst/Programmer - Fairbanks North Star Borough
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
Frequent Contributor

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

--
Roger Asbury
Analyst/Programmer - Fairbanks North Star Borough
0 Kudos