Clipping and Mosaicking Imagery

03-16-2016 08:42 AM
New Contributor II

Hello all,

I have a question regarding clipping and mosaicking imagery that I been trying to figure out.  Here's the process I have been performing:

I have several (hundreds) feature class polygons in which I have used to clip imagery out of into separate raster files.  The attached file shows one of these files.  However, as you can see from the attached file in the lower right hand corner, a little section of imagery was not included.  The reason for this was because this was fly over imagery and the original raster did not include this little area.  What I have been doing is clipping NAIP imagery out for these little areas and then merging them together.  However, there are several files that I need to perform this task to (around 100) and was looking to see if there was more of an automatic process to get these areas included in the rasters.  Any help would be greatly appreciated.

Thanks in advance!


0 Kudos
1 Reply
MVP Honored Contributor

I suspect the best answer is to create and clip from a mosaic dataset, but as I'm on a Basic license and can't create such a dataset, here's a bit of a workaround.

You can add your rasters to an unmanaged raster catalog, which stores pointers to the individual rasters. From there, you can select the raster catalog rows that overlap your clipping feature. Clip those features and mosaic.

Here's some starter code that will list the raster names overlapping a clip feature class, that you can feed into raster clip, then mosaic to new raster.

>>> clip = 'clip' # clip layer
... catalog = 'unmanaged' # unmanaged raster catalog
... arcpy.SelectLayerByLocation_management(catalog,"INTERSECT",clip) # make selection
... with arcpy.da.SearchCursor(catalog,'Name') as cursor: # loop through selected raster footprints
...     for row in cursor:
...         print row[0] # print raster name