Create a geotiff file with updated metadata tags without an aux.xml file… here is a solution to the problem.
Create a geotiff file with updated metadata tags without an aux.xml file
I was able to open the raster GeoTiff file using python and Gdal and insert a new tag in the associated metadata. After the metadata is updated, a PAM (.aux.xml) file is created that contains the added information.
Is there a way to create a GeoTiff file using Python and/or Gdal that contains all the added metadata without connecting to the PAM file?
Solution
You can set the GDAL_PAM_ENABLED
environment variable to NO
:
https://trac.osgeo.org/gdal/wiki/ConfigOptions#GDAL_PAM_ENABLED
In Python, this can be done in the following ways:
import os
os.environ['GDAL_PAM_ENABLED'] = 'NO'
Note that this will only be set once for the current Python session.
If you calculate the histogram of a GeoTiff file after setup, GDAL will not create an aux.xml file
info = gdal. Info('somefile.tif', reportHistograms=True)