AnsweredAssumed Answered

XYTabletoPoint_managment tool error

Question asked by csyoo0717@skku.edu on Dec 8, 2018

Hello,

I have created a .csv file through following code.

public void CreateCSV(DataTable dataTable, string filePath, string delimiter = ",")

{

if (!Directory.Exists(System.IO.Path.GetDirectoryName(filePath)))

throw new DirectoryNotFoundException($"Destination folder not found: {filePath}");

var columns = dataTable.Columns.Cast<DataColumn>().ToArray();

var lines = (new[] { string.Join(delimiter, columns.Select(c => c.ColumnName)) })

.Union(dataTable.Rows.Cast<DataRow>().Select(row => string.Join(delimiter, columns.Select(c => row[c]))));

File.WriteAllLines(filePath, lines);

}

File created successfully and I can manually load and make XY to Point conversion using Geoprocessing tool. It also goes successful but when I try to achieve this through C# code it gives the following error.

GPtool error message

GP tool code is given below

try

{

string st_in = @"C:\Users\Aizaz\Documents\ArcGIS\Projects\MyProject\new.csv";

string st_out = @"C:\Users\Aizaz\Documents\ArcGIS\Projects\MyProject\Settlement_m";

//var envArray = Geoprocessing.MakeEnvironmentArray(null);

var args = Geoprocessing.MakeValueArray(st_in, "Long", "Lat", "Settlement", st_out, "");

string tool_path = "XYTableToPoint_management";

IGPResult ret = await Geoprocessing.ExecuteToolAsync(tool_path, args/*, envArray*/);

if (ret.IsFailed)

{

ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show($@"Error {ret.ErrorCode} in GP Tool: {ret.ErrorMessages}");

}

var rset = Geoprocessing.ExecuteToolAsync(tool_path, args, null, null, GPExecuteToolFlags.Default);

}

catch

{ }

Any idea what this error means? because I cannot find anything about it in ArcGIS Pro examples or online resources etc.....

Outcomes