[gdal-dev] Cropping to another image?

Daniel Clewley daniel.clewley at gmail.com
Tue Apr 23 13:01:27 PDT 2013


Hi,

I did something similar to what Doug suggested using the GDAL python 
bindings to get the size, projection and pixel size of an image, then 
cropping and re projecting to match using gdalwarp.
You can view the code at:

https://bitbucket.org/petebunting/rsgis_scripts/src/c999df5483d3ed988feac016008f7623a28a484e/GDAL/subsetImage2Image.py?at=default

Hope this helps,

Thanks,

Dan

On 23/04/13 12:00, gdal-dev-request at lists.osgeo.org wrote:
> Message: 7 Date: Tue, 23 Apr 2013 14:15:25 -0400 From: "Newcomb, Doug" 
> <doug_newcomb at fws.gov> To: Jonathan Greenberg <jgrn at illinois.edu> Cc: 
> gdal dev <gdal-dev at lists.osgeo.org> Subject: Re: [gdal-dev] Cropping 
> to another image? Message-ID: 
> <CALQGVr1Abv2OubqRFVWF1=LjkFtNqRcW_19ebDBE5Vf6VcrpCQ at mail.gmail.com> 
> Content-Type: text/plain; charset="iso-8859-1" --j, I you wanted to 
> use the gdal utility programs , you can use gdalinfo to get the extent 
> of the first image and use gdal_translate -projwin with the 
> coordinates you captured from the first command. There are a couple of 
> ways to pythonify those two commands or other python methods into a 
> single script for batch processing, see 
> http://www.gdal.org/gdal_tutorial.html Doug On Tue, Apr 23, 2013 at 
> 12:47 PM, Jonathan Greenberg <jgrn at illinois.edu>wrote:
>> >GDALers:
>> >
>> >Is there a way to easily crop one image to the the extent of another image?
>> >
>> >--j
>> >
>> >--
>> >Jonathan A. Greenberg, PhD
>> >Assistant Professor
>> >Global Environmental Analysis and Remote Sensing (GEARS) Laboratory
>> >Department of Geography and Geographic Information Science
>> >University of Illinois at Urbana-Champaign
>> >607 South Mathews Avenue, MC 150
>> >Urbana, IL 61801
>> >Phone: 217-300-1924
>> >http://www.geog.illinois.edu/~jgrn/
>> >AIM: jgrn307, MSN:jgrn307 at hotmail.com, Gchat: jgrn307, Skype: jgrn3007
>> >_______________________________________________
>> >gdal-dev mailing list
>> >gdal-dev at lists.osgeo.org
>> >http://lists.osgeo.org/mailman/listinfo/gdal-dev
>> >



More information about the gdal-dev mailing list