[Gdal-dev] some geotiff export problems

Frank Warmerdam warmerdam at pobox.com
Sun Nov 24 21:36:01 EST 2002


Vladimir Slepnev wrote:
> Hello.
> 
> 
> 1) I've been trying to use GDAL to export some data into the GeoTIFF format,
> and I encountered some problems I can't solve on my own. There are both
> "code" and "documentation" problems. Am I writing to the right place?

Vladimir,

This is the right place.

> 2) From the GeoTIFF format specification I gather that GeoTIFF doesn't
> support arbitrary metadata. In fact, I was unable to write _any_ metadata
> into a GeoTIFF file and read it back successfully using GDAL. The GDAL docs
> don't say _anything_ on this subject.
> Is it that I did something wrong?
> Is there any way to, say, write the GTCitationGeoKey string using GDAL? I
> could pack some metadata into this string...
> Or do I have to merge GDAL and libgeotiff code? This may be tricky...

Currently only selected items can be read/written via the GetMetadata()
and SetMetadata() API in the GeoTIFF driver.  These are the DOCUMENTNAME,
IMAGEDESCRIPTION, SOFTWARE and DATETIME tags in TIFF which correspond
to TIFFTAG_DOCUMENTNAME and so forth in the metadata api.

There is no really appropriate place to put full GDAL style metadata
in a GeoTIFF file, but I have been thinking I should overload some
tag for this purpose, or add an application specific one.

> 3) Our GIS uses PROJ.4 strings internally to define projections. From the
> documentation, there's no obvious way to pass a PROJ.4 string into a
> GTiffDataset, although PROJ.4 is "linkaged" into GDAL. Using
> SetProjection(), naturally, doesn't work.
> By rummaging through the source code, I was able to find a way to convert
> PROJ.4 strings into WKT strings and vice versa - initializing an
> OGRSpatialReference from one and exporting into the other. Can I rely on
> this feature? It is not documented in _any_ way - importFromProj4 and
> exportToProj4 are even missing from the "all members of OGRSpatialReference"
> list found on the Web, although they're there and seem to work OK :-)

The omission of importFromProj4() and exportToProj4() from the documentation
was unintentional.  I have added documentation for these methods today.  Note
that the SetFromUserInput() method will accept a variety of formats to
initialize an OGRSpatialReference(), including PROJ.4.

You can rely on importFromProj4() and exportToProj4().  Note that the
OGRCoordinateTransformation class uses PROJ.4 to do it's work, and actually
uses exportToProj4() to convert OGRSpatialReferences into a form that can
be used to initialize PROJ.4.

> 4) It seems that linear units are _not_ written into the GeoTIFF file if we
> pass them in a WKT string. They are read correctly, but when I try to write
> feet, I always get meters. Running the resulting file through listgeo, I see
> no linear unit information at all. The code responsible for  this job seems
> to reside in frmts\gtiff\gt_wkt_srs.cpp, and I was unable to find any code
> that writes linear units - there's just a blank line after the comment
> "write linear units information". Is the problem with me?

This is an embarrasing omission given my other role as libgeotiff maintainer,
and general supporter of GeoTIFF.  I will do some work on the geotiff driver
tonight and report back later on the improvements.


> I understand those may be stupid questions...
> but could you please answer me?

Not stupid questions at all.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent





More information about the Gdal-dev mailing list