Select to view content in your preferred language

ArcGIS Maps SDK for .NET – AddRastersParameters.InputFile fails with CSV (works in ArcGIS Pro)

329
3
3 weeks ago
Labels (2)
GIS_USER24
New Contributor

I’m working with ArcGIS Maps SDK for .NET(WPF) to add additional rasters to a mosaic dataset using

Spoiler
await mosaicRaster.AddRastersAsync(addRastersParameters)
I tried setting  InputFile directly to a raster path, but that failed with:
ArcGISRuntimeException: Invalid argument: Invalid input CSV file.
 
When I set InputFile to a CSV containing paths to TIFF rasters, I get the same exception.
 
Code snippet used:
 
Spoiler

var addRastersParameters = new AddRastersParameters
{
InputFile = @"D:\Sample\CODE\25\Data\Sample.csv",
};

await mosaicRaster.AddRastersAsync(addRastersParameters);

However, the same CSV works in ArcGIS Pro when using the Add Rasters to Mosaic Dataset tool.
  • Raster type: Raster Dataset (TIFF)
  • Input Data: File -> Add file Sample.csv

Is there a specific CSV schema or format that the Maps SDK for .NET expects for InputFileAre there any examples for using Input File with raster datasets (e.g., TIFF)? 

Please suggest. Thanks.

Supporting Details:

SDK Version: 200.6

.Net Framework: 4.7.2

Pro Version: 3.4

 Attaching the snap of the csv file for reference

GIS_USER24_0-1765966808023.png

 

 

0 Kudos
3 Replies
imalcolm_esri
Esri Contributor
Hi,
 
It looks like the AddRasters function has some pretty specific requirements for the csv schema. The minimum columns required are path, name, group_name, and alias. We'll talk to the docs team about adding better documentation for that behavior.

Also it seems there may be a bug when a group_name value is shared between multiple subsequent rows, so to be safe you may want to make it different for each raster listed in the csv.
GIS_USER24
New Contributor

Hi, thanks for the reply.

I tried using the suggested CSV schema, but it’s still failing on my side with the same exception: ArcGISRuntimeException: Invalid argument: Invalid input CSV file.

I’ve attached the sample CSV file used for reference. Below is the code snippet showing how the CSV is being passed to AddRasters.

var addRastersParameters = new AddRastersParameters
{
InputFile = @"D:\Test\Sample.csv"
};

await mosaicRaster.AddRastersAsync(addRastersParameters);

Please let me know if there’s anything missing or incorrectly configured.

0 Kudos
imalcolm_esri
Esri Contributor

I believe the column names need to be included. Attaching a file as an example, let me know if it works this time!

0 Kudos