0

I am doing a lot of image tile processing and ultimately need to generate some very large rasters (for example 300k x 400k pixels). These might be mosaiced from 1000+ individual tiles. If I calculate pyramids and statistics using gdaladdo and gdal_edit, QGIS can read it right in. However, if I load that TIFF into ArcGIS Pro, I'll wait about 18-24 hours for the statistics to calculate. On Windows I have this running from a generated batch script.

with open('teststats.bat', 'w') as mybat:
    mybat.write(r'gdaladdo --config USE_RRD YES --config GDAL_NUM_THREADS 20 {0} '.format(outFile) +'\n')
    mybat.write(r'gdal_edit.py -stats {0}'.format(outFile) +'\n')    
    mybat.write(r'gdalinfo {0} -stats --config GDAL_PAM_ENABLED TRUE'.format(outFileIMG) +'\n') 
subprocess.call([r'teststats.bat'])

I found on this question How to get GDAL to create statistics for GTiff in Python that adding the GDAL_PAM_ENABLED flag would generate a similar stats xml to what arc generates. That is now creating the xml but arc still immediately starts calculating stats. I know some will say, "Just read it in QGIS" but that won't work for my business environment.

Vince
  • 20,017
  • 15
  • 45
  • 64
kpierce8
  • 151
  • 6
  • 2
    What is your output format? It looks like HFA from your variable names but USE_RRD has no effect on HFA files. Would you consider COG as your output format? They contain internal overviews but with the -stats translate option the statistics are calculated in a format that Esri will understand. It would probably be quicker to GDAL_Translate -of COG -stats -r nearest -co COMPRESS=LZW than to GDALAddO. – Michael Stimson Mar 05 '24 at 00:58
  • If your business environment requires ArcGIS, it may be easier to do all the processing using arcpy instead of GDAL (including generating statistics). Of course, QGIS will probably not be able to read the stats then, but does that matter in this case? – Son of a Beach Mar 06 '24 at 23:34

0 Answers0