[Gdal-dev] some geotiff export problems

Vladimir Slepnev slepnev_v at newmail.ru
Sun Nov 24 04:24:56 EST 2002


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?


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...


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 :-)


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?


5) Here are some listgeo snippets.

A "good" GeoTIFF file (not GDAL-generated):

   Keyed_Information:
      GTModelTypeGeoKey (Short,1): ModelTypeProjected
      GTRasterTypeGeoKey (Short,1): RasterPixelIsPoint
      GTCitationGeoKey (Ascii,25): "UTM Zone 37 N with WGS84"
      GeogLinearUnitsGeoKey (Short,1): Linear_Meter
      GeogAngularUnitsGeoKey (Short,1): Angular_Degree
      ProjectedCSTypeGeoKey (Short,1): PCS_WGS84_UTM_zone_37N
      End_Of_Keys.
   End_Of_Geotiff.


A GDAL-generated file:

   Keyed_Information:
      GTModelTypeGeoKey (Short,1): ModelTypeProjected
      GTRasterTypeGeoKey (Short,1): RasterPixelIsArea
      ProjectedCSTypeGeoKey (Short,1): User-Defined
      ProjectionGeoKey (Short,1): Proj_UTM_zone_25N
      End_Of_Keys.
   End_Of_Geotiff.

Why is ProjectedCSTypeGeoKey "User-Defined"?
Why no linear units? I passed 'em, they were there in both the PROJ.4 string
and the (converted from PROJ.4) WKT string!
Why no GTCitationGeoKey?
What's up with ProjectedCSTypeGeoKey and ProjectionGeoKey? Is GDAL confusing
them?


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

Vladimir Slepnev
Programmer, RDC ScanEx




More information about the Gdal-dev mailing list