[gdal-dev] How to add georeferencing tags to a .tif?

Greg Coats gregcoats at mac.com
Tue Sep 22 11:26:22 EDT 2009


When gdal_translate reads in a GeoTIFF .tif file and writes out a .ppm  
file, the user receives a warning message saying that the  
georeferencing metadata is not being copied into the output .ppm file,  
and is being lost. When gdal_translate reads in a .tif file with TIFF  
tag 700 XMP metadata, and TIFF tag 33723 IPTC metadata, and writes out  
a .tif or .jp2 file, the user receives no warning that this metadata  
is not being copied, and so I was surprised to later learn that the  
XMP and IPTC metadata had been lost by gdal_translate.

I suggest that for GDAL 1.7 consideration be given to at least  
notifying the user via a warning message that any input .tif file with  
TIFF tag 700 XMP metadata, and TIFF tag 33723 IPTC metadata, and TIFF  
tag 34665 EXIF metadata will lose that metadata and not have it copied  
to the output file. Hopefully, a future GDAL release of gdal_translate  
will preserve TIFF tag 700 XMP metadata, and TIFF tag 33723 IPTC  
metadata, and the widely used TIFF tag 34665 EXIF metadata that  
supports GPS metadata.

The Kakadu applications kdu_compress and kdu_expand, which are  
available for free for Win32, Mac OS X, Linux, and Solaris, support  
conversions between TIFF/GeoTIFF .tif files and JPEG2000/ 
GeoJPEG2000 .jp2 while preserving TIFF tag 700 XMP metadata, TIFF tag  
33723 IPTC metadata, and TIFF tags 33550, 33922, 34264, 34735, 34736,  
34737 georeferencing metadata.
Greg

On Sep 8, 2009, at 5:32 PM, Even Rouault wrote:

> Selon Greg Coats <gregcoats at mac.com>:
>
>> I have one .tif that has tag 700 XMP metadata, and has a tag 33723
>> IPTC metadata, but does not have tags 33550, 33922, 34264, 34735,
>> 34736, 34737 georeferencing metadata. I have a second .tif that has
>> does not have tag 700 XMP metadata, nor does it have tag 33723 IPTC
>> metadata, but it does have 33550, 33922, 34264, 34735, 34736, 34737
>> georeferencing metadata. I want to add the tags that provide
>> georeferencing metadata in the second .tif, to the first .tif. As
>> shown below, I first tried using geotifcp, and then tried
>> gdal_translate, but while the resulting .tif does have the
>> georeferencing tags it originally lacked, the resulting .tif is
>> without the tag 700 XMP metadata, and without the tag 33723 IPTC
>> metadata that it originally had. How can georeferencing tags be added
>> to a .tif, withOUT removing preexisting tag 700 XMP metadata, and
>> withOUT removing preexisting tag IPTC 33723 metadata?
>> listgeo 18stj940125.tif > 18stj940125_listgeo.txt
>> geotifcp -s -r 1 -c none -f msb2lsb -g 18stj940125_listgeo.txt
>> tif_withXMP700_withIPTC33723_withoutGeo.tif
>> tif_withXMP700_withIPTC33723_withGeo.tif
>
> Those 700 XMP and 33723 IPTC tags are not handled by the GTiff  
> driver neither in
> read nor in write mode, so that explains why gdal_translate doesn't  
> copy them.
> You could probably try the 'tiffset' utility to set them afterwards.  
> Or hack
> geotifcp.c to add support for those 2 tags. The tags[] array looks  
> like an
> interesting place where to hack that in.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20090922/7a2391f5/attachment.html


More information about the gdal-dev mailing list