Getting error:
ExecuteError: ERROR 999999: Something unexpected caused the tool to fail.
with arcpy.management.AddRastersToMosaicDataset
Don't usually do much imagery work. So, it's possible I'm making a rookie mistake here.
I created a Mosaic Dataset using Tools in ArcGIS Pro 3.1 and adding 200 (discontinuous) file system rasters (TIFF).
Now, I want to see how I can script this with arcpy but the below fails:
import arcpy
rastertype = "Raster Dataset"
mdname = r"<path_to_mosaic_dataset>"
inpath = r"<path_to_file_system_raster>"
arcpy.management.AddRastersToMosaicDataset(
mdname, rastertype, inpath)
# I can use arcpy.Describe to confirm that both paths are valid paths to the right data/file type
I see some similar reports related to this tool but for older versions of Pro. Anyone seeing this in Pro 3.x or have a suggestion what I should try?
Likely a silly question on my part, but have you updated lines 4 & 5 of the Python snippet to the file paths to your Mosaic Dataset and the folder where the individual raster files are stored before running the code?
3.1 is quite old, you can go back to 3.3 in the help topic, but for 3.5
Add Rasters To Mosaic Dataset (Data Management)—ArcGIS Pro | Documentation
You can only add rasters to a mosaic dataset contained in a geodatabase. Those created outside a geodatabase can only contain the contents of a previously created mosaic dataset.
So what is the mosaic datased in a gdb?
@DanPatterson - there's a little trick to seeing the Help Documentation before 3.3. In the URL for the current release of the ArcGIS Pro documentation, in the URL where you see in the bracket's the word 'latest', type 3.1 there and then hit the Enter key. Now you're seeing the 3.1 documenation! For the MDS topic, the help goes back to 2.6 and then stops.
Thanks for chiming in, folks! @Alec Yeah, of course, I had replaced those <paths> with some real world file paths. But you're right, it's always good to check that stuff. Typically, I use something like:
os.path.join(arcpy.env.workspace,fc_name) # ... or raster_name in this case
@Dan I find it impossible to keep up with ArcGIS Pro releases. I am glad to have all my environments on some version of 3.x. But I find the gains from upgrading are meager. 2 bug fixes come with 3 new bugs. I'm about to go to 3.3.x or 3.4 to work with Enterprise 11.3+.
In this case, Error 99999 should've made me think. Even at Pro 3+, just re-starting Pro solved the issue. Maybe when we get to ArcGIS Pro 5, this kind of issue will be a thing of the past. 😂