I have a large number of airphotos giving coverage of an area going back decades. – someone may have a smoother means to accomplish my goal here. I'm weak in Python sadly. I'm attempting to shrink/trim/eliminate a given number of pixels along the edges of the .TIF airphotos that I have.
The photos are quite old and scanned from negatives, and have black borders from the scanning of the film negatives, so I can't set nodata=0,0,0 as the border isn't a perfect 0,0,0 (in some cases water features are closer to 0,0,0 that then border is)
There's too many images to sensibly do this individually. I'll walk through my thoughts/plan below. My end goal is to use Build Footprints 'Shrink Distance' Feature:
- Use recursive iteration to go through every .geotiff airphoto within the "airphotos" folder.
- Create a file geodatabase where the name of the .gdb matches the raster
- Create a Mosaic Dataset within that File Geodatabase [Mosaicmb]. The tools run as hoped up to this point, i've been able to create all the geodatabases.
- Here the problems start: Add the raster that is being iterated to the newly created empty mosaic dataset. Fails with the error listed below
- Build Footprints, and use the shrink feature to eliminate my borders, by cutting say 50 pixels off all sides of each photo.
ArcGIS reports that mosaicmb doesn't exist – which it obviously doesn't, and it won't exist until the tool runs.
If you know a slick way to trim border pixels, that will help too.
Error 000732 - Mosaic Dataset: Dataset Q:\.......\test5\%name%.gdb\mosaicmb does not exist or is not supported
I'm still experimenting and trying what works, but at this point I'm shooting in the dark and praying. I'll update if I have a breakthrough.
Best Answer
You might attempt to set a "precondition" by linking the mosaicmb variable to the Add Raster To Mosaic Dataset a second time, and choosing "precondition" when the connect tool of ModelBuilder shows it's context menu.
A pre-condition will ensure the File Geodatabase and Mosaic Dataset will be created in advance of the Add Raster To Mosaic Dataset being run.
See the ArcGIS Help: http://desktop.arcgis.com/en/desktop/latest/analyze/modelbuilder/a-quick-tour-of-using-precondition.htm