[FWTools] Re: ReadRaster syntax
Bryan Keith
bryan at geomega.com
Thu Sep 1 13:44:16 EDT 2005
Hello,
I realize my original question may have not been very clear, but I
solved my immediate problem. The second row of a raster ought to be
read like this:
band.ReadRaster(0,1,band.XSize,1,band.XSize,1,GDT_Float32)
not like I had guessed before. So row n + 1 of a raster is read like this:
band.ReadRaster(0,n,band.XSize,2,band.XSize,1,GDT_Float32)
I'm still not totally clear what each parameter of the ReadRaster method
is specifying. If someone can point me to a help file, I'd appreciate
it. Thanks.
Bryan
Bryan Keith wrote:
> 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