Hello Tom Thanks. It also worked for me Thanks Monica
On Tue, Jun 29, 2010 at 3:01 PM, Kralidis,Tom [Ontario] < [email protected]> wrote: > > > > -----Original Message----- > > From: [email protected] > > [mailto:[email protected]] On Behalf Of Monica Buescu > > Sent: Tuesday, 29 June 2010 09:49 > > To: [email protected] > > Subject: [gdal-dev] Retrieving pixel corners through Python-gdal > > > > Greetings > > > > I'm a kind of newbie in GDAL specially in Python-GDAL. I'm > > doing a script to do some minor image processing but I need > > to retrieve, in a Python Scrpt, coorners coordinates > > (top-left; bottom-right). Is there any way to retrieve this > > using gdalpython? > > > > Thanks > > > > Monica > > > > This has worked for me: > > import osgeo.gdal as gdal > > ds = gdal.Open('foo.tif') > gt = ds.GetGeoTransform() > width = ds.RasterXSize > height = ds.RasterYSize > miny = gt[3] + width*gt[4] + height*gt[5] > maxx = gt[0] + width*gt[1] + height*gt[2] > # bbox of raster (minx, miny, maxx, maxy) > bbox = (gt[0], miny, maxx, gt[3]) > > ..Tom >
_______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
