Would it be possible to simply detect and count overlaps between raster files, i.e. not polygons against rasters, using arcpy? By default I don't have the spatial analyst extension for ArcMap 10.1 but if need be I could acquire one temporarily. I need to iterate over small tif files in various directories and test them against large rasters.

  • 1
    Rasters have an extent property in the describe, you can easily test for extent-overlap-extent but when you are talking about cell-on-cell it's a bit more difficult. Probably best to use GDAL in python to test that. – Michael Stimson Jul 23 '14 at 23:22
  • Right. I was thinking I might create a mosaic dataset, build footprint polygons and just test that rather than try for a shortcut. Something of the sort. – Sleep6 Jul 23 '14 at 23:30
  • That would work no doubt, I would use os.walk to search folders and subfolders then arcpy.describe to get the extent object and then using extent.XMin, extent.YMin... test for numerical intersection with the big raster(s). If you're not comfortable with that you can os.walk to get the folders and then use arcpy.listRasters() to list the rasters in each folder and subfolder. – Michael Stimson Jul 23 '14 at 23:32
  • Are these single band rasters or multiband? – Aaron Jul 23 '14 at 23:50
  • They're single-band narrow pathways. As such I don't think the extent trick would work in this specific case, but it's a good tip. – Sleep6 Jul 24 '14 at 15:21

Try the following workflow:

  1. Reclassify your rasters so that Value = 1.
  2. Calculate Cell Statistics using a "SUM" statistic.

Any value in the resulting raster > 1 is an overlap area. Additionally, the value of the resulting raster indicates how many overlapping rasters there are.

  • 2
    I like that approach @aaron. How then would you turn that into a boolean yes/no for overlap? Perhaps calculate statistics and use arcpy.GetRasterProperties_management(raster,"MAXIMUM") to indicate overlap. – Michael Stimson Jul 24 '14 at 0:25
  • Good ideas, though I'd have to reclassify all my rasters of which there are many. Thanks for the tip. – Sleep6 Jul 24 '14 at 15:23
  • @Sleep6 You could automate this very quickly using ModelBuilder. – Aaron Jul 24 '14 at 15:51
  • True, it's just that the data is all over the place, which is why I thought arcpy would be the better choice to crawl through various subfolders. – Sleep6 Jul 24 '14 at 16:44
  • @Sleep6 It would be great to use Python with this approach. All of your narrow pathways in each raster would then have the value of "1" and background values in the raster extent would have "0" values. It would also be very easy to use arcpy.da.walk to grab all of the rasters in various directories. – Aaron Jul 24 '14 at 16:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.