[Gdal-dev] more problems
Vladimir Slepnev
slepnev_v at newmail.ru
Fri Nov 29 19:57:20 EST 2002
Hello, it's me again.
1) You wrote that
> 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.
It doesn't seem to work.
Here is the source code of my test routine:
GDALAllRegister();
GDALDataset *output = (GDALDataset *) GDALOpen( "pic3.tiff", GA_Update );
output->SetMetadataItem("TIFFTAG_DOCUMENTNAME","Sample data");
printf("%s\n",output->GetMetadataItem("TIFFTAG_DOCUMENTNAME"));
delete output;
output = (GDALDataset *) GDALOpen( "pic3.tiff", GA_ReadOnly );
printf("%s\n",output->GetMetadataItem("TIFFTAG_DOCUMENTNAME")); //Same line
as above!
return 0;
Here is the output:
Sample data
(null)
pic3.tiff is a valid TIFF file that exists in the program's directory.
It seems that either the read or the write doesn't work. Am I wrong?
If I delete the file pic3.tiff and change the first GDALOpen() call to a
Create() call, the file gets created, but the metadata item is still not
written or not read correctly.
2) Here's one more problem I can't solve.
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.
Here's what I get if I write the string ""+proj=utm +zone=11 +ellps=WGS84
+units=us-ft":
Keyed_Information:
GTModelTypeGeoKey (Short,1): ModelTypeProjected
GTRasterTypeGeoKey (Short,1): RasterPixelIsArea
ProjectedCSTypeGeoKey (Short,1): User-Defined
ProjectionGeoKey (Short,1): Proj_UTM_zone_11N
ProjLinearUnitsGeoKey (Short,1): Linear_Foot_US_Survey
End_Of_Keys.
End_Of_Geotiff.
Here's what I get if I write the string ""+proj=utm +zone=11 +datum=WGS84
+units=us-ft":
Keyed_Information:
GTModelTypeGeoKey (Short,1): ModelTypeProjected
GTRasterTypeGeoKey (Short,1): RasterPixelIsArea
ProjectedCSTypeGeoKey (Short,1): Unknown-4326
ProjLinearUnitsGeoKey (Short,1): Linear_Foot_US_Survey
End_Of_Keys.
End_Of_Geotiff.
Once again, the questions are:
Why is ProjectedCSTypeGeoKey "user-defined" in the second case? What does it
mean? Isn't it wrong?
What is ProjectionGeoKey in the second case? Doesn't GDAL confuse it with
ProjectedCSTypeGeoKey in the first case?
Why is the third case so utterly wrong?
And once again, why is the GTCitationGeoKey not written?
All I did was convert the string to WKT through an OGRSpatialReference and
then write it using SetProjection(). I did _not_ use gdal_translate.
Sorry for the inconvenience,
Vladimir Slepnev
Programmer, RDC ScanEx
More information about the Gdal-dev
mailing list