[gdal-dev] Re: GDAL Python Tutorial Create GeoTiff Issue
Andre
achpta at tuks.co.za
Mon Dec 1 08:12:36 EST 2008
Managed to get it working with the following
raster = numpy.zeros( (n_rows, n_cols), dtype = numpy.uint8)
On Mon, Dec 1, 2008 at 12:49 PM, Andre <achpta at tuks.co.za> wrote:
> Good day,
>
> I implemented Python the tutorial
> (http://www.gdal.org/gdal_tutorial.html) that explains how to create a
> new GeoTiff. Unfortunately I receive the following error:
>
> ===============================================================
> Traceback (most recent call last):
> File "asc2geotiff.py", line 131, in <module>
> gw.save_file(options.output_file)
> File "asc2geotiff.py", line 117, in save_file
> dst_ds.GetRasterBand(1).WriteArray( raster )
> File "/usr/lib/python2.5/site-packages/gdal.py", line 796, in WriteArray
>
> File "usr/lib/python2.5/site-packages/osgeo/gdal_array.py", line
> 154, in BandWriteArray
> AttributeError: dtype
> ===============================================================
>
> I would guess it should rather look something like:
> raster = Numeric.zeros( (512, 512), numpy.uint8)
> or
> raster = Numeric.zeros( (512, 512), dtype='d')
>
> I tried to assign a type to the raster data, but without success. Any
> help would be appreciated.
>
> Regards,
> Andre
>
More information about the gdal-dev
mailing list