Select to view content in your preferred language

Remove a layer using ArcGis Pro SDK 2.4

1970
5
Jump to solution
07-06-2020 06:27 PM
TOSHKIMAKINO
Emerging Contributor

Hi, 

 

How do you remove FeatureClass from file geodatabase programmatically using the ArcGIS Pro SDK?

 

Thank´s

0 Kudos
1 Solution

Accepted Solutions
RichRuh
Esri Regular Contributor

DDL (data definition language) operations are not natively supported in the Pro SDK.  You need to use the geoprocessing routines to run the "Delete" tool to delete the dataset.

I hope this helps,

--Rich

View solution in original post

0 Kudos
5 Replies
RichRuh
Esri Regular Contributor

DDL (data definition language) operations are not natively supported in the Pro SDK.  You need to use the geoprocessing routines to run the "Delete" tool to delete the dataset.

I hope this helps,

--Rich

0 Kudos
TOSHKIMAKINO
Emerging Contributor

Hi Rich,

Thank you for answering my question.

I'll give "Delete" tool a try.

0 Kudos
Wolf
by Esri Regular Contributor
Esri Regular Contributor

There is a sample that deletes a table from a File Geodatabase: Edit Operation Row Event 

You might be able to use this snippet from this sample:

QueuedTask.Run(async() =>
  {
    //find layer and derive geodatabase
    var cpLayer = MapView.Active.Map.FindLayers("CrowdPlanning").FirstOrDefault() as FeatureLayer;
    var geodatabase = cpLayer.GetFeatureClass().GetDatastore() as Geodatabase;

    //Advise 
    //Delete the editlog table
    var mva = Geoprocessing.MakeValueArray(geodatabase.GetPath().AbsolutePath,"EditLog");
    await Geoprocessing.ExecuteToolAsync("Delete_management", mva);
  });
TOSHKIMAKINO
Emerging Contributor

Hi Wolfgang,

Thank you.
It's working perfectly.

0 Kudos
qingluo1
New Contributor

Hi Wolf, 

 

How do you remove WMTS layer using the ArcGIS Pro SDK?

 

Thank´s

0 Kudos