Cannot add raster data to mosaic dataset

238
0
03-02-2024 04:25 AM
Labels (2)
TomGeo
by
Occasional Contributor III

I am trying to add a directory full of raster files to a mosaic dataset. All my data (raster files and GDB with the mosaic dataset) are on a drive attached as close as possible to our Image Server.
To connect to the file share I am using the UNC path e.g. \\img-storage.adddmz.com\raster\project\orthophotos.

I had no problem creating the geodatabase in the project directory, but already creating the mosaic dataset in that geodatabase (let's call it mosaic.gdb) took ages.

Now I am trying to add the raster files from the orthophotos directory to the mosaic dataset. The raster data are JPGs, where each JPG comes along with a *.JGW  and a *.JPG.AUX.XML file.

When I tried to use the geoprocessing tool in ArcGIS Pro version 3.2.1 I experienced that the program became unresponsive right after pointing the tool to the mosaic dataset. The next time it took for ever was when I defined the source for the raster data. Here I defined the path to the directory where the raster files recide in. This might be related to the numbers of JPGs in the directory (490), but I would not see the point why the tool has to index the files in the directory at this point.

When I run the tool then it looks fine at the beginning, but there are no messages about what raster file is processed or anything in the details of the tool. Looking in the rasterproxies directory where the cache should be build, there is not even a directory created for the job!

So I was moving over to Python, hoping to get at least some info.
Everything seems pretty slow, but runs until I run the AddRasterToMosaicDataset.

 

import os
import arcpy

 

takes 13.5 seconds

 

arcpy.env.workspace = r'\\img-storage.adddmz.com\raster\project\orthophotos'
sr = arcpy.SpatialReference(29902)

 

takes 57.7 seconds!

 

in_mosaic_dataset=os.path.join(arcpy.env.workspace,'mosaic.gdb','m_dataset')
arcpy.AddRastersToMosaicDataset_management(
    in_mosaic_dataset=in_mosaic_dataset,
    raster_type="Raster Dataset",
    input_path=arcpy.env.workspace,
    update_cellsize_ranges="UPDATE_CELL_SIZES",
    update_boundary="UPDATE_BOUNDARY",
    update_overviews="UPDATE_OVERVIEWS",
    maximum_pyramid_levels=None,
    maximum_cell_size=0,
    minimum_dimension=1500,
    spatial_reference=sr,
    filter="*.jpg",
    sub_folder="NO_SUBFOLDERS",
    duplicate_items_action="OVERWRITE_DUPLICATES",
    build_pyramids="BUILD_PYRAMIDS",
    calculate_statistics="CALCULATE_STATISTICS",
    build_thumbnails="BUILD_THUMBNAILS",
    operation_description="",
    force_spatial_reference="NO_FORCE_SPATIAL_REFERENCE",
    estimate_statistics="ESTIMATE_STATISTICS",
    aux_inputs=None,
    enable_pixel_cache="NO_PIXEL_CACHE",
    cache_location=r"C:\Users\me\AppData\Local\ESRI\rasterproxies\m_dataset"
)

 

 

throws the following error:

ExecuteError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_27880\1483089116.py  in <cell line: 2>()
         1 in_mosaic_dataset=os.path.join(arcpy.env.workspace,'mosaic.gdb','m_dataset')
----> 2 arcpy.AddRastersToMosaicDataset_management(
         3 in_mosaic_dataset=in_mosaic_dataset,
         4 raster_type="Raster Dataset",
         5 input_path=arcpy.env.workspace,

C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py in AddRastersToMosaicDataset(in_mosaic_dataset, raster_type, input_path, update_cellsize_ranges, update_boundary, update_overviews, maximum_pyramid_levels, maximum_cell_size, minimum_dimension, spatial_reference, filter, sub_folder, duplicate_items_action, build_pyramids, calculate_statistics, build_thumbnails, operation_description, force_spatial_reference, estimate_statistics, aux_inputs, enable_pixel_cache, cache_location)
    14066 return retval
    14067 except Exception as e:
> 14068 raise e
    14069
    14070 @gptooldoc('AlterMosaicDatasetSchema_management', None)

C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py in AddRastersToMosaicDataset(in_mosaic_dataset, raster_type, input_path, update_cellsize_ranges, update_boundary, update_overviews, maximum_pyramid_levels, maximum_cell_size, minimum_dimension, spatial_reference, filter, sub_folder, duplicate_items_action, build_pyramids, calculate_statistics, build_thumbnails, operation_description, force_spatial_reference, estimate_statistics, aux_inputs, enable_pixel_cache, cache_location)
    14063 from arcpy.arcobjects.arcobjectconversion import convertArcObjectToPythonObject
    14064 try:
> 14065 retval convertArcObjectToPythonObject(gp.AddRastersToMosaicDataset_management(*gp_fixargs((in_mosaic_dataset, raster_type, input_path, update_cellsize_ranges, update_boundary, update_overviews, maximum_pyramid_levels, maximum_cell_size, minimum_dimension, spatial_reference, filter, sub_folder, duplicate_items_action, build_pyramids, calculate_statistics, build_thumbnails, operation_description, force_spatial_reference, estimate_statistics, aux_inputs, enable_pixel_cache, cache_location), True)))
    14066 return retval
    14067 except Exception as e:

C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py in <lambda>(*args)
       518 val = getattr(self._gp, attr)
...
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000732: Mosaic Dataset: Dataset \\img-storage.adddmz.com\raster\project\orthophotos\mosaic.gdb\m_dataset does not exist or is not supported
ERROR 000732: Input Data: Dataset \\img-storage.adddmz.com\raster\project\orthophotos does not exist or is not supported Failed to execute (AddRastersToMosaicDataset).

 

Can somebody, based on the provided information tell me why I cannot add the raster data to the mosaic dataset? The mosaic dataset does exists, and it is loading just fine into a map in ArcGIS Pro.

- We are living in the 21st century.
GIS moved on and nobody needs a format consisting out of at least three files! No, nobody needs shapefiles, not even for the sake of an exchange format. Folks, use GeoPackage to exchange data with other GIS!
0 Kudos
0 Replies