How does ArcMap determine minimum and maximum raster values (e.g. for rendering colour ramps) when a raster file lacks an auxiliary file (e.g. aux.xml) describing statistics?

This question is related to my previous question here, which describes a situation where, for GeoTiffs generated by gdalwarp, ArcMap displayed the minimum as 268.048, while the true minimum was 91.2931.

Does ArcMap inspect an initial subset of cells, and set statistics based on those cells' values? If so, can this behaviour be prevented other than by ensuring auxiliary files are created and distributed with the raster? It seems like risky behaviour, since unless a user ensures that statistics have been fully calculated, rendered output might easily be misinterpreted.

  • 1
    I think that ArcMap gets the statistics from the pyramids (if they exist). When a raster is displayed it is resampled to match the screen and from this the min/max is approximated if pyramids don't exist. It is best to calculate the statistics for a raster properly and not skip rows/columns just in case the min/max value is skipped over. Jan 8, 2015 at 1:18
  • Thanks @Michael. By "resampled to match the screen", do you mean that the raster is resampled according to the number of pixels it occupies on the screen? I've tried adding freshly-generated tiffs (1) zoomed way in, and (2) zoomed to a layer of equal extent, and this doesn't seem to affect the min/max values calculated.
    – jbaums
    Jan 8, 2015 at 1:58
  • 1
    Yes, in order to display the raster it has to be reduced to the screen resolution. The min/max will not change after it is calculated unless you select statistics 'from current extent' in the symbology tab. Jan 8, 2015 at 2:29

1 Answer 1


I'm assuming you are using GeoTIFF files.

From what I've seen, ArcGIS 10.0 and later obtain the statistics from GDAL metadata tags within the GeoTIFF file. For instance, if you use the command gdalinfo myraster.tif:


For older versions of ArcGIS, these embedded metadata are ignored, but similar values are in a separate file, called myraster.tif.aux.xml file (I asked about this a few years ago). I don't know which one takes precedence, if both are available. Note that gdalinfo -stats adds the statistics to the .aux.xml file only. I normally delete the .aux.xml file.

Statistics can recalculated and stored in the GDAL metadata using a small Python script:

import os
import sys
from osgeo import gdal
src_fname = sys.argv[1]
aux_fname = src_fname + '.aux.xml'
if os.path.isfile(aux_fname):
ds = gdal.Open(src_fname, 1)
for i in range(ds.RasterCount):
    stats = ds.GetRasterBand(i + 1).ComputeStatistics(0)
    print('Band %d: %s' % (i + 1, stats))
ds = None  # save, close

This script deletes the .aux.xml file if present, which I find problematic if the raster values change and is a redundant file. The ComputeStatistics call generally does the right job, and it even handles NODATA values correctly.

  • Thanks, Mike - makes sense. Does you script generate the aux.xml file, or does it only modify the metadata within the tiff?
    – jbaums
    Jan 8, 2015 at 21:17
  • 1
    It should generally update the internal metadata. But, I'm not sure what happens if there is also an aux.xml file. I normally delete this file, and ArcGIS seems OK with this.
    – Mike T
    Jan 8, 2015 at 21:19
  • 1
    A wee update: gdalinfo -stats creates the .aux.xml file which I'm finding can block updates to the statistics (if values change), so the script deletes this redundant file before proceeding.
    – Mike T
    Jan 9, 2015 at 3:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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