4

If I want to create a GDAL PAM statistics file with the command gdalinfo -stats from a GRIB file, e.g. needed for DynamicColorMapping, GDAL only creates the statistics internally inside the sourcefile. Is it possible to force gdalinfo -stats to create the additional file (.aux.xml)?

A way to do this is programmatically with Python and to tinker with the XML, but that doesn't fit my needs.

2 Answers 2

8

As a workaround you can use command

gdalinfo -stats -hist input.tif

Selecting the histogram option triggers the creation of input.tif.aux.xml file.

EDIT

I have learned that actually there is no need to use the -hist workaround. There is a GDAL configuration option GDAL_PAM_ENABLED that forces the creation of the .aux.xml file. Usage example:

gdalinfo test.tif -stats --config GDAL_PAM_ENABLED TRUE
0
3

The following isn't a direct GDAL solution for your question, but it might help. The Orfeo Toolbox command otbcli_ComputeImagesStatistics can be used to generate raster band statistics and output them to an XML file. For instance:

otbcli_ComputeImagesStatistics -il input_image.tif -out output.xml

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.