[R-sig-Geo] Adding (custom) tags to a geotif

Shaun Walbridge SWalbridge at esri.com
Wed Jul 1 21:17:29 CEST 2015


Assuming you're using GeoTIFF files, you could store the metadata in one
of the related metadata fields listed in the GDAL documentation [1].
These can be set in a variety of ways, such as using the gdal_translate
function within your gdalUtils package, and setting the 'mo' option
with the necessary fields:

  mo  Character. ("META-TAG=VALUE"). Passes a metadata key and value to
    set on the output dataset if possible.

Another approach would be doing something more robust with the PAM
.aux.xml files that GDAL can generate and parse [2]. For example, see
the spMetadata method of plotKML [3].

1. http://www.gdal.org/frmt_gtiff.html
2. http://www.gdal.org/classGDALPamDataset.html#_details
3. http://plotkml.r-forge.r-project.org/spMetadata.html

--
Shaun Walbridge
GIS Developer



On 7/1/15, 6:28 AM, "R-sig-Geo on behalf of Matteo Mattiuzzi"
<r-sig-geo-bounces at r-project.org on behalf of matteo.mattiuzzi at boku.ac.at>
wrote:

>Dear list,
>
>I would like to add some meta information to a tif file. As my tif file
>can created by one or more source files depending on its location, I need
>to safe this information inside my tif.
>
>Precisely I need to add if the specific file _could_ be created by one or
>two files (names of them) and then a second tag with the information of
>_effectively_ used source files for the creation of this file.
>
>
>Similar to the INPUTFILENAME tag in a composite eos-hdf:
>gdalinfo on a MOD13Q1:
>INPUTFILENAME=MOD09GQK.A2006129.h17v07.005.2008318081508.hdf,
>MOD09GQK.A2006130.h17v07.005.2008318122057.hdf.....
>
>It does not necessary has to be a R solution, can also be something
>executed from within R (gdal, libtiff...)
>
>(I work on a Linux system and I need it there, but portability is always
>preferable!)
>
>Thanks,
>Matteo
>  
> 
>
>_______________________________________________
>R-sig-Geo mailing list
>R-sig-Geo at r-project.org
>https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



More information about the R-sig-Geo mailing list