add support for "history" metadataitem which keeps track of all GDAL command line operations
|Reported by:||etourigny||Owned by:||etourigny|
|Severity:||normal||Keywords:||netcdf, metadata, history|
A useful feature implemented in most netcdf files and applications is the use of a "history" attribute which logs every operation done on a file. It appears that ESRI offers a similar mechanism.
It would be very useful to have such a feature within GDAL. However, current code lacks a mechanism to record a command.
As part of improvements to the netcdf driver, I have implemented this into the CreateCopy() function for the driver. The function GDALGeneralCmdLineProcessor() is called in every application , therefore it is a suitable target for saving the command line (without modifying any existing application). Attached is a patch to gdal.h and gdal_misc.cpp, with new functions GDALSetCmdLine() and GDALGetCmdLine() and a modification to GDALGeneralCmdLineProcessor().
An open question is how can the metadata be saved to file without having to re-write every application and/or every driver. Perhaps it could be embedded into GDALDataset or GDALDriver with per-driver options allowing the history to be saved? There are various occasions which do not warrant a save of command-line, for exampls calls to gdalinfo.
Any hints or comments are welcome.