Monday, September 18, 2023

New Tool - Align Rasters Toolbox for ArcGIS Pro Part I

This is the first in a two part series on the Align Rasters Toolbox. I recently posted these tools as geoprocessing samples on the Esri website - https://www.arcgis.co/home/item.html?id=4f5e9d4e3b974890991d33e7e5251231

Aligning rasters such that their bounding extent and cell sizes match precisely is a tedious, time consuming, and challenging task. East-to-use tools have been lacking up until now. Many modeling approaches require rasters to be perfectly aligned. For example, a common workflow using R would be to stack rasters and then do subsequent predictive modeling using the stacked rasters as covariates. The Align Rasters Toolbox allows users to quickly and easily align rasters. It has options for working with rasters of differing cell sizes and extents.

The Align Rasters Toolbox for ArcGIS Pro only has two tools. Align Rasters without Expansion is appropriate when there are not gaps and the template raster is smaller than the intersection of all input rasters. Align Rasters with Expansion uses resampling to fill gaps and holes. It is appropriate in cases where the template might exceed the size of one or more inputs or there is a gap or hole in one of the input rasters. All tools use ModelBuilder and none contain python scripts.



 

 


The Align Rasters without Expansion has five input parameters.

Input folder – The input folder is a folder that contains a set of TIF rasters. The model would need to be modified to accommodate other file types like geodatabase or IMAGINE files. You can use the Copy Raster tool in Batch mode to create a clean folder of TIF files. I recommend removing any shapefiles or other files from the input folder.

Template Raster – The template raster is a TIF raster with the coordinate system, number of rows, number of columns, cell size, and extent that you wish all of the rasters in the input folder to have. The template raster can be one of the rasters in the input folder.

Output Folder – The output folder is an empty folder that you wish to write all output TIF files to.

Temp Folder – The temp folder is a folder to store temporary outputs. All temporary files are deleted by the Align Rasters without Expansion tool.

Output Coordinate System – Select the output coordinate system to be the same as the coordinate system of the template raster. You can check this in the raster properties.


 

 

 

 

 

 

 

 

The Align Rasters without Expansion tool can also be customized in ModelBuiler (edit mode). To access ModelBuilder right click on the Align Rasters without Expansion model and select Edit. The model can be run from the ModelBuilder interface in addition to being run as a tool in ArcToolbox. The key step in this model is the Extract by Mask tool.

The Align Rasters with Expansion has six parameters.

Input folder – The input folder is a folder that contains a set of TIF rasters. The model would need to be modified to accommodate other file types like geodatabase or IMAGINE files. You can use the Copy Raster tool in Batch mode to create a clean folder of TIF files. I recommend removing any shapefiles or other files from the input folder.

Template Raster – The template raster is a TIF raster with the coordinate system, number of rows, number of columns, cell size, and extent that you wish all of the rasters in the input folder to have. The template raster can be one of the rasters in the input folder.

Output Folder – The output folder is an empty folder that you wish to write all output TIF files to.

Temp Folder – The temp folder is a folder to store temporary outputs. All temporary files are deleted by the Align Rasters without Expansion tool.

Output Coordinate System – Select the output coordinate system to be the same as the coordinate system of the template raster. You can check this in the raster properties.

Max Neighborhood - Expansion occurs using resampling (focal/neighborhood statistics). Select a neighborhood size that is 13 or greater and an odd number. The default is 33. Select the smallest possible number that ensures that expansion will exceed the extent of the template raster.


 

 

 

 

 

 

 

The Align Rasters with Expansion tool can also be customized in ModelBuiler (edit mode). To access ModelBuilder right click on the Align Rasters with Expansion model and select Edit. The model can be run from the ModelBuilder interface in addition to being run as a tool in ArcToolbox. The Align Rasters with Expansion is more complicated than Align Rasters without Expansion because it has several additional steps in which the Focal Statistics tool is run and each Focal Statistics run is mosaicked together in a manner that uses the smallest amount of resampling (i.e. the Mosaic to New Raster tool uses the FIRST option to ensure priority is given to the original raster followed by the 3x3 neighborhood, then the 5x5, etc.


 

No comments:

Post a Comment