[gdal-dev] Query regarding using gdalwarp with cutlineSQL

Prasun Kumar Gupta prasunkgupta at gmail.com
Wed Jul 29 23:44:44 PDT 2020


 Hi,

I am trying to clip a raster using a polygon layer. I want to specify a
where clause to select one polygon feature from the polygon layer and
subset the raster *only *for that one polygon feature.

I am not getting the intended results with this line of code:

ds = gdal.Warp('output.tif', 'input.tif', format = 'GTiff', \
               cutlineDSName = 'parcel.shp', \
               cutlineSQL = 'SELECT * FROM parcel', \
               cutlineWhere = 'name = "first"')
if ds is None:
    print('Failed')else:
    print('Success')# prints Success but gives same result as without
the cutlineSQL and cutlineWhere options

Problem is also explained in detail on StackExchange
<https://gis.stackexchange.com/questions/369065/incorrect-results-while-cropping-with-gdalwarp-and-cutlinesql>
(with screenshots and sample data).
Could someone please let me know what I am missing?

Regards,
Prasun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200730/89951161/attachment.html>


More information about the gdal-dev mailing list