[gdal-dev] Using gdalwarp to effectively trim an image

drshinnick drshinnick at hotmail.com
Thu Mar 15 08:40:30 EDT 2012


Hello everyone!

I'm hoping someone can shed some light on the use of gdalwarp for me.  I'm
trying to use it to effectively trim an mosaicked image of its sawtooth
edges by masking the area outside a line as defined by a shapefile.  I've
been successful when using a single polygon such as with this command here:

gdalwarp -cutline .\shp -cl 1642 -crop_to_cutline .\1642\1642.bmp
.\cutlinetest.tif

Where 1642.shp is located in the .\shp directory.  1642.shp is a single
polygon record extracted from a larger multi-record shape file know as
'allROIS.shp' also located at .\shp and contains a field named 'item'.

The problem is that I have a whole mess of these things that i need to trim. 
So I was trying to use the -csql switch to reference the particular record
within 'allROIs.shp' but I'm not having much luck.  The command i'm issuing
is:

gdalwarp -cutline .\shp -csql "select * from allROIs where item = 1642"
-crop_to_cutline .\1642.bmp .\cutlinetest.tif

The error I'm receiving is:

Cannot compute bounding box of cutline.

The individual polygons within allROIs.shp overlap but are separate records. 
Not sure if that's significant.

Any insight is appreciated.  Thanks.

-Dan

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Using-gdalwarp-to-effectively-trim-an-image-tp4621161p4621161.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list