[gdal-dev] GDAL Python Development: Area Selection

Poovendran Moodley moodleyp at cs.ukzn.ac.za
Wed May 27 06:06:10 EDT 2009


Hi there,

I want to select only a region of a raster file; that is, suppose I know the
coordinates that form a bounding box around a region, I want to select just
that region and write it to another file.

I'm rather new to GDAL and thus far I'm only aware of one way to do this;
since I'm using Python:

> scanline = band.ReadRaster( 0, 0, band.XSize, 1, band.XSize, 1, GDT_Float32 <http://www.gdal.org/gdal_8h.html#22e22ce0a55036a96f652765793fb7a4f5cbd2f96abffd9ac061fc0dced5cbba> )
>
> I believe that I can specify the window of raster data to read using the
3rd till 6th input parameters of the above method (with reasonable size
reads untill the entire regions I'm interested in is read).

Is there some other way this was suppose to be done? The method above will
require me to convert my coordinates into rows and columns (I think) which
is fine... but leaves room for error so I'd like to only rely on GDAL
routines. Can someone please advise? It could very well be that I'm totally
mistaken... I hope this isn't such a bad question...

Kind regards
Pooven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20090527/ea161547/attachment.html


More information about the gdal-dev mailing list