I have four band .tif that I am trying to clip to the shapefile extent with:
gdal.Warp(OutDS, inRaster, cutlineDSName = InShapefile1, cropToCutline = True, dstNodata = inNoData)
using Python and GDAL I first open the raster and then try to clip it band by band. The result has only zeros. Clipping shapefile has only one polygon geometry but it is possible that it extends out of raster's bounds in some cases. I've tried to perform clip with color composite but result is the same. Also the output single band rasters are read by, for example, ArcMap as multiband composites.
The link to the sample data is here: https://dl.dropboxusercontent.com/u/83030488/Tiff/Sent10.rar
By implementing the subprocess, call method I managed to identify the error. The problem was that I did not have the system veriable GDAL_DATA set correctly.
Now another error came out:
ERROR 4: `EPSG:3912' does not exist in the file system, and is not recognized as a supported dataset name.
I am calling gdalwarp with:
path= str(outClipedRasterPath) os.chdir(path) cmd = 'gdalwarp -dstnodata -9999 -cutline -s_srs EPSG:3912 -t_srs EPSG:3912 ' + InShapefile1 + ' -crop_to_cutline -of GTiff ' + inRaster + OutDS call(cmd)