I have a few hundred high resolution geotiffs (cell size 2m) such as the example below which I am trying to rename according to the location in an index layer (red rectangles in example below). I would like to add the attribute of the index rectangle in front of the filename (in this case "B6_filename.tif") which covers the most of the data pixels in the geotiff (black are NoData values, coloured values are data pixels).
What I tried so far is this:
- Reclassify the raster to a binary mask with data pixels and NoData values using the reclassify tool
- Convert Raster to Polygon (takes over an hour probably due to the high resolution data and is therefore not suitable when trying to automate this for hundreds of geotiffs with arcpy)
- Creating an extent shapefile using the
Raster Domaintool available within the 3d Analyst licence
I was thinking of further using this extent shapefile together with an
Intersect analysis to calculate the area percentage of each intersected part. However the extent of the raster extracted by the
Raster Domain tool results in a rectangle and not around the data pixel values (blue rectangle in example below).
My approaches were not successful.
Is there another way to solve this problem?
In the end I am attempting to rename my sample file "filename.tif" to "B6_filename.tif" with B6 referring to the proportionally largest area covering the index rectangle.