1

I work on a Windows QGis 2.14 platform. I need to clip a raster with a vectorial polygon. When I use gdalwarp I cannot find where is the setting for establishing the output graticule position respect the source raster. I know that in the ESRI ArcGIS clip raster tool is there a command like "maintain the same graticule as the source". Without this option gdalwarp gives me back a raster with cell shifted (offset) respect the source. In fact the new origin of the output raster is determinate by the rectangular envelope of the polygon (obviously).

Suggestions for me, also workaround if necessary?

Similar questions didn't answer this question.

3
  • 1
    gdal.org/gdalwarp.html -tap: (GDAL >= 1.8.0) (target aligned pixels) align the coordinates of the extent of the output file to the values of the -tr, such that the aligned extent includes the minimum extent. – user30184 May 12 '17 at 12:27
  • @PolyGeo I thank you for your kind answer. I applied it: Inside a simple QGis 2.14 (GDAL 2.1.3) project with only two files, same SR EPSG:23033, I loaded: a GeoTiff raster (cells 10x10 meters) a SHP vector with a single bnd polygon To clip the raster with the polygon, I tried this (from your suggestion): gdalwarp -ot Float32 -q -of GTiff -tr 10.0 -10.0 -tap -cutline D:\area_clip.shp -co COMPRESS=DEFLATE -co PREDICTOR=1 -co ZLEVEL=6 D:\difesa_x100.tif "[temporary file]"The result was a new raster shifted horizontally about an half of cell. – danielao222 May 15 '17 at 8:26
  • @PolyGeo Then I tried another: gdalwarp -ot Float32 -q -of GTiff -tr 10.0 -10.0 -tap -cutline D:\area_clip.shp -crop_to_cutline -co COMPRESS=DEFLATE -co PREDICTOR=1 -co ZLEVEL=6 D:\difesa_x100.tif "[temporary file]" Then I had the same identical result shifted. I cannot understand where is the error. – danielao222 May 15 '17 at 8:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.