[Gdal-dev] GDAL: projection data not copying completely

Kyler Laird Kyler at Lairds.com
Wed Jun 30 15:40:53 EDT 2004


It's been reported that GeoTIFF images I create using GDAL are unusable
by some applications.
	http://groups.google.com/groups?selm=5foEc.18210%24Pc.11314%40fe1.texas.rr.com

The issue seems to be projection data.  As a test, I tried to create a
new GeoTIFF from an existing one, using the existing image's projection
data.
	a = gdal.Open('/tmp/a.tif')

	b = gdal.GetDriverByName('GTiff').Create(
		'/tmp/b.tif',
		a.RasterXSize, a.RasterYSize,
		3, gdal.GDT_Byte,
		[ 'TILED=YES' ]
	)

	b.SetDescription(a.GetDescription())
	b.SetProjection(a.GetProjection())
	b.SetGeoTransform(a.GetGeoTransform())
	b.SetMetadata(a.GetMetadata())

Performing a diff on the output of listgeo for each of these images, I
see the culprit(s).
	<       ProjNatOriginLongGeoKey (Double,1): -89
	<       ProjFalseOriginLongGeoKey (Double,1): 0
	>       ProjFalseEastingGeoKey (Double,1): 0
	>       ProjFalseNorthingGeoKey (Double,1): 0
	>       ProjFalseOriginLongGeoKey (Double,1): -89
	<       ProjFalseOriginEastingGeoKey (Double,1): 0
	<       ProjFalseOriginNorthingGeoKey (Double,1): 0

Any ideas on how to get GDAL to fully copy the existing settings?

Thank you.

--kyler




More information about the Gdal-dev mailing list