Building .NET Console Application Using ArcGIS Pro .NET SDK

486
4
05-22-2020 03:01 AM
AnujKatiyar
New Contributor

Hi,

I am rewriting ArcObjects .NET Console Application using the Pro SDK. I want to dynamically create / delete shape file in my console application using  Pro SDK but i am not finding any documentation for Pro SDK  for such requirements.

Can you please provide any code sample for same ?

0 Kudos
4 Replies
MattDriscoll1
New Contributor II

You will need to use geoprocessing tools probably.  

Run a geoprocessing task and python script | ArcGIS for Developers 

I personally use python to do these types of task.  If I want a gui aspect to it I will just put the python script in the solution and run it from there.

public async Task<IGPResult> ExecuteModel()
{

var progDlg = new ProgressDialog("Running Geoprocessing Tool", "Cancel");
progDlg.Show();

var progSrc = new CancelableProgressorSource(progDlg);



var pathPython = System.IO.Path.GetDirectoryName((new
System.Uri(Assembly.GetExecutingAssembly().CodeBase)).AbsolutePath);
pathPython = Uri.UnescapeDataString(pathPython);
System.Diagnostics.Debug.WriteLine(pathPython);


var tool_path = System.IO.Path.Combine(pathPython, @"PytonToolbox.pyt\Tool");

var parameters = Geoprocessing.MakeValueArray();

IGPResult gp_result = await Geoprocessing.ExecuteToolAsync(tool_path,
parameters, null, new CancelableProgressorSource(progDlg).Progressor);

Geoprocessing.ShowMessageBox(gp_result.Messages, tool_path,
gp_result.IsFailed ? GPMessageBoxStyle.Error : GPMessageBoxStyle.Default);

return gp_result;

}
RichRuh
Esri Regular Contributor

Anuj,

Matt is correct.  The Pro SDK does not yet support Data Definition Language (DDL) operations directly.  If you are writing a Pro Add-in, you need to use the geoprocessing API.  In a stand-alone CoreHost application, you need to shell out to a Python script.

--Rich

AnujKatiyar
New Contributor

Thanks Rich,  Can we use ArcObjects .NET SDK &  Pro SDK together in a CoreHost application ?

0 Kudos
RichRuh
Esri Regular Contributor

Anuj,

The Pro SDK is implemented in terms of ArcObjects.  While I've never tried it personally, I expect the two APIs would interfere with each other.  It's definitely not supported.

--Rich

0 Kudos