MosaicToNewRaster input parameter formatting help

132
2
08-13-2020 10:14 AM
HuyNgo
by
New Contributor

Running the MosaicToNewRaster tool works fine when I use the tool in ArcMap but it fails in .net when I use the exact same inputs.  It leaves me to think that the way "input_rasters" is set up is wrong.  Can anyone help me with correctly formatting my input_rasters string?  This is typically happening only when I want to use more than 1 tiff file as input.

I have tried:

1) input_rasters = "'path\imgDirectory\img1.tiff';'path\imgDirectory\img2.tiff'"

2) input_rasters = "'path\imgDirectory\img1.tiff','path\imgDirectory\img2.tiff'"

3) I have tried inserting a string[] with the paths

but for some reason, I think the way I format my "input_rasters" is wrong.  Because how can I get the Tool to work in ArcMap with the exact same parameters but not in c#?  

The code and input works when trying to export as a tiff in c#, but will not work when exporting as a .jpg in c#.  We want a .jpg because it is significantly smaller than a tiff file.

Tags (3)
0 Kudos
2 Replies
MichaelBranscomb
Esri Frequent Contributor

Hi,

I recommend exposing the parameter as a string and using inline variable substitution if you're using ModelBuilder or a similar approach if you're writing a Python script. For more information see Inline variable substitution—ArcGIS Pro | Documentation.

If you want to input multiple file names (strings) then you should consider defining the input parameter as a multi-value parameter. For more information see Setting script tool parameters—ArcGIS Pro | Documentation.

Thanks

Mike

0 Kudos
HuyNgo
by
New Contributor

Thanks for the response Michael, I ended up putting all of the MosaicToNewRaster code into a Python Script.  while passing in my exact same parameters that I attempted to use in the c# version.  It works as expected.  So I technically didn't get this issue solved for anyone looking to leverage this tool in C# with multiple input raster.  I recommend to just create a python scripts if you need to call the code from c# 

0 Kudos