[gdal-dev] how to save history of gdal commands in metadata?

Etienne Tourigny etourigny.dev at gmail.com
Wed Oct 19 14:10:32 EDT 2011


I've figured out a way to save any comandline command : as
GDALGeneralCmdLineProcessor() gets called by all applications, the
command args can be saved to a static char[] and then consulted later.

My question to other devs: where can I add code to create/modify a
metadataitem (e.g. "history") in code so that it happens almost
transparently?  Having to add it in every application would be a drag,
so maybe in GDALDataset or GDALDriver?

I have created a ticket with more information, if anyone has ideas or
comments please do so.

http://trac.osgeo.org/gdal/ticket/4297

Regards, Etienne

On Wed, Oct 5, 2011 at 8:43 PM, Matt Wilkie <matt.wilkie at gov.yk.ca> wrote:
> Esri records (some) processing history in the metadata and at times I have
> found that to be *very* useful. I for one would welcome gdal/ogr doing the
> same.
>
> matt wilkie
> --------------------------------------------
> Geomatics Analyst
> Information Management and Technology
> Yukon Department of Environment
> 10 Burns Road * Whitehorse, Yukon * Y1A 4Y9
> 867-667-8133 Tel * 867-393-7003 Fax
> http://environmentyukon.gov.yk.ca/geomatics/
> --------------------------------------------
>
>
> On 05/10/2011 4:08 PM, Etienne Tourigny wrote:
>>
>> Hi all,
>>
>> I am adding support for the netcdf history attribute (which keeps
>> track of all commands done on an netcdf file), I am trying to see how
>> to include as much possible information as possible in the
>> NCDFCreateCopy() function.
>>
>> Firstly, is there a way to access to the current command line which
>> generated a GDALCreateCopy()?  All I have access to is what is passed
>> to the NCDFCreateCopy() function, such as filename, input dataset,
>> driver options.
>>
>> Secondly, would there be interest in introducing this sort of feature
>> into the GDAL framework?  I would see it as an optional string which
>> could be passed from the calling script to the Create() and
>> CreateCopy() methods, or perhaps a global variable which drivers would
>> be free to use or not.
>> As Geotiff supports metadata, it would be a nice addition to it.
>>
>> Here is an example of netcdf history metadata:
>> As you can see there is not much information from the GDAL command yet.
>>
>> {{{
>>                :history = "Wed Oct 05 19:59:26 2011: GDAL NCDFCreateCopy(
>> trmm-cp51.nc, ... )\n",
>>                        "Wed Sep 07 22:33:59 2011: cdo
>> sellonlatbox,-80,-70,-20,-10
>> tmp4-noc.nc tmp5.nc\n",
>>                        "Wed Sep  7 22:33:53 2011: ncatted -a
>> Conventions,global,d,,
>> tmp4.nc tmp4-noc.nc\n",
>>                        "Wed Aug 24 12:59:04 2011: ncatted -D 10 -a
>> CoreMetadata.0,global,d,, -a ArchiveMetadata.0,global,d,, tmp3.nc
>> tmp4.nc\n",
>>                        "Tue Aug 23 21:04:45 2011: cdo seltimestep,1
>> tmp2.nc tmp3.nc\n",
>>                        "Tue Aug 23 19:19:18 2011: cdo selvar,pcp tmp1.nc
>> tmp2.nc\n",
>>                        "Tue May 17 19:34:24 2011: cdo
>> sellonlatbox,-85.25,-29.625,15.25,-50 3B43.2011.nc tmp1.nc\n",
>>                        "Tue May 17 19:26:31 2011: cdo mergetime
>> 3B43.110101.6A.nc
>> 3B43.110201.6A.nc 3B43.110301.6A.nc 3B43.110401.6A.nc 3B43.2011.nc" ;
>> }}}
>>
>> Regards,
>> Etienne
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>> .
>>
>


More information about the gdal-dev mailing list