[gdal-dev] crop a non-square subwindow?
Frank Warmerdam
warmerdam at pobox.com
Wed Mar 9 12:35:57 EST 2011
On 11-03-09 11:51 AM, Wendell Turner wrote:
>
> Do any of the gdal utilities crop an image on non-square
> boundaries?
>
> I use gdal_translate with -projwin ulx uly lrx lry to crop
> an image that is square (left and right edges are vertical,
> and the top and bottom edges are horizontal). Is there a
> command that will crop other shapes, for instance a diamond
> shape, where the edges are not horizontal/vertical?
>
> If it must be done by programming (pref. Python), is there a
> sample that I could use to start with?
Wendell,
I think gdalwarp with -crop_to_cutline and a cutline specified
with the shape will accomplish what you want.
http://www.gdal.org/gdalwarp.html
The cutline comes from an OGR supported file but this can be as simple
as a .csv file with a WKT geometry in it. The -crop_to_cutline may be
new to 1.8.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the gdal-dev
mailing list