How to programmatically access the paths of a mosaic dataset's source rasters?

2703
2
Jump to solution
08-27-2015 10:17 AM
Labels (1)
DanSlayback1
New Contributor III

I am working with mosaic datasets with many source rasters (10's to 100's of thousands) and we need to keep track of the filesystem path of those source rasters. My process to add rasters to the mosaic dataset automatically populates an added "path" field in the footprints table of the mosaic dataset. However, in a small number of cases, this fails (for unknown reasons), and the field is left as Null. So I'm looking for a way to fix those, after the fact.

I know that you can see the source raster's path by clicking on <RASTER> in the footprints table, going to the Functions tab, and then right-click --> Properties of the listed image. But I cannot do this manually for the hundreds of Null entries.  I would like to fully automate via a python script or custom GP service.

Is there a way to access that information, for example even via the Field Calculator in the footprints table? The "raster" item is available in the list of fields, but I've no idea how to write a python or VB Script expression to extract the source file's path from that 'raster' item, or any other information, or if thats even possible.  Or if there is another way to access this information....any suggestions much appreciated!

0 Kudos
1 Solution

Accepted Solutions
GabrielUpchurch1
Occasional Contributor III

I am not a python genius like many on GeoNet but perhaps you can work the Export Mosaic Dataset Paths GP tool (ExportMosaicDatasetPaths_management) into a python script.  Obviously, there would be a lot more to the script than just exporting paths but this tool will at least give you access to the paths via python.

View solution in original post

2 Replies
GabrielUpchurch1
Occasional Contributor III

I am not a python genius like many on GeoNet but perhaps you can work the Export Mosaic Dataset Paths GP tool (ExportMosaicDatasetPaths_management) into a python script.  Obviously, there would be a lot more to the script than just exporting paths but this tool will at least give you access to the paths via python.

DanSlayback1
New Contributor III

Ah...yes..thanks very much! That should certainly do it. Not sure how I missed that tool, I thought I'd searched all over...

If anyone knows if this is possible from the Field Calculator, that would still be helpful for quick/manual updates, but I can definitely solve my problem with this tool.

0 Kudos