I'm trying to use the "CreateXYEventLayer" tool to create a point event layer from a .csv file. It works when I use the tool from within the project, but when I try to do it via the SDK (with the same .csv file), it fails. Is something wrong with my parameters or the way that I am executing the tool? P.S. I'm very new to the ArcGIS SDK. Thanks in advance! Here is the code:
public async Task CreatePointEventLayerFromCsv(string csvPath)
{
var parameters = Geoprocessing.MakeValueArray(
csvPath,
"X",
"Y",
"NewEventLayer",
SpatialReferenceBuilder.CreateSpatialReference(4326)
);
var result = await QueuedTask.Run(() =>
{
return Geoprocessing.ExecuteToolAsync("CreateXYEventLayer_management", parameters);
});
if (result.IsFailed)
{
MessageBox.Show("Failed to create point event layer from CSV");
}
else
{
MessageBox.Show("Success");
}
}