[FWTools] ReadRaster syntax

Bryan Keith bryan at geomega.com
Thu Sep 1 12:53:42 EDT 2005


I start with this Python code:

import gdal
from gdalconst import *
dataset = gdal.Open('ned_dem.asc',GA_ReadOnly)
band = dataset.GetRasterBand(1)

this line reads the first row in the raster:

scanline = band.ReadRaster(0,0,band.XSize,1,band.XSize,1,GDT_Float32)

this line reads the second row in the raster:

scanline = band.ReadRaster(0,0,band.XSize,2,band.XSize,1,GDT_Float32)

however, this line also reads the second row in the raster:

scanline = band.ReadRaster(0,0,band.XSize,3,band.XSize,1,GDT_Float32)

I'm guessing there's a problem with way I'm using the ReadRaster method, 
but I haven't found any information on what each parameter is supposed 
to be.  Thanks.

Bryan

Bryan Keith
GIS Specialist
Geomega, Inc.
Boulder, CO, USA


More information about the FWTools mailing list