raster cell alignment

264
1
02-08-2019 08:19 PM
Highlighted
New Contributor

I need to be able to confirm if raster cells are aligned and GP tools use the snap raster environment.  I have experienced quite a variety of results.    

My current workflow has 6 rasters with the same spatial reference and cell resolution.  To confirm the cells are aligned would save a considerable amount of time by not having to look at all 6 rasters at once.

For testing I have used the following steps:

1. Create a fishnet from the extent of the first raster > select by location using a polygon representation of the rasters where the centroid of the fishnet feature is within the underlying polygon > switch selection and delete all of the fishnet features that do not overlap the polygon > using a search cursor and the python random module select 3 test areas.

2. Extract each raster using the sample fishnet features one at a time

3. Convert those to points in order to have a center of the raster cell vector representation.

4. Merge the points and then remove duplicates.

5. Check results.

I might be wrong but I would think if all the cells were aligned the points would have to be identical and have the same coordinates.  The code works and I do get points but I would like for the resulting point feature class to be empty.  To me if the feature class is empty then all of the points are in the exact same place so I could get the attributes as a list/tuple or other container.  Then the check would be if not attribute_list: pass else: fail.  I thought that asking about this would help give me perspective and consider other solutions.  

Sorry I do not have the code in front of me as I am at home.  If someone takes an interest in this post I would be more than happy to share.

Thank you for your time,

James L. Huffines

Reply
0 Kudos
1 Reply
Highlighted
MVP Esteemed Contributor

Rasters cells are aligned by specifying a 'snap raster' in the environment settings for tools in arctoolbox that support it... like Copy Raster and many more.

Cell size, extent and snap raster will need to be all done and considered if you want to ensure alignment of your raster products.

Snap Raster (Environment setting)—Geoprocessing | ArcGIS Desktop