[Gdal-dev] python geotiff raster creation
Didrik Pinte
dpinte at itae.be
Wed Apr 26 11:13:38 EDT 2006
Hi,
I'm trying to save a numpy array coming from a Fortran model to a raster
file.
The coordinate system is a ED50/UTM zone30. Everything works fine except
that the GeoTIFF file is a big white square without any information ...
Trying gdal2xyz.py, i see that I have some values in the raster ...
Do someone have an idea on my problem ?
Here is the part of the script that export the raster file :
----------------------------------------------------------------------
#!/usr/bin/python
[...]
dst_filename = 'test' + str(self.active_z[i]) + '.tiff'
driver = gdal.GetDriverByName( "GTiff" )
dst_ds = driver.Create( dst_filename, len(self.idx['X']),\
len(self.idx['Y']), 1, gdal.GDT_Float32 \
['TFW=YES' 'COMPRESS=PACKBITS'] )
dst_ds.SetGeoTransform( [ self.coord['X'][0], \
self.coord['X'][1]-self.coord['X'][0],\
0, \
self.coord['Y'][0],\
0, \
self.coord['Y'][1]-self.coord['Y'][0]]
)
srs = osr.SpatialReference()
srs.SetWellKnownGeogCS( "EPSG:23030" );
dst_ds.SetProjection( srs.ExportToWkt() )
raster = self.matrix[:,:,self.active_z[i]]
dst_ds.GetRasterBand(1).WriteArray( transpose(raster) )
dst_ds.FlushCache()
del(dst_ds)
----------------------------------------------------------------------
Thanks in advance for your help
--
Didrik Pinte
Research assistant
University catholic of Louvain
pinte at geru.ucl.ac.be
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Ceci est une partie de message
=?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=
Url : http://lists.osgeo.org/pipermail/gdal-dev/attachments/20060426/555b6763/attachment.bin
More information about the Gdal-dev
mailing list