0

I try to clip raster data with GDAL (in fact I am using QGIS, which produces me a command line for GDAL) The raster has been transformed to EPSG:3857, which is also the projection of the shapefile which contains the boundaries.

gdalwarp -dstnodata 0 -q -cutline D:\GIS\data\cutline_shape.shp 
 -crop_to_cutline -of GTiff D:\GIS\data\raster_3857.tif D:/GIS/data/clipped_raster.tif

The clipping processes without error, but the GDAL clips a wrong portion of the raster, it has the correct shape but is about 20 km to the north of the shapefile.

nmtoken
  • 13,355
  • 5
  • 38
  • 87
ABX
  • 737
  • 12
  • 28
  • 1
    Have you checked both files with gdalsrsinfo? I had similar issues when using EPSG:900913 instead of EPSG:3857. – AndreJ May 31 '13 at 11:09

2 Answers2

0

You can try reprojecting the raster data but to EPSG:102113 instead, don't use 3857.

This post may help: Reprojecting WGS 1984 Web Mercator (EPSG:3857) in Python with GDAL

Web-GIS entrepreneur
  • 1,545
  • 1
  • 13
  • 28
0

if I do not reproject the raster data (it is in EPSG:31468 - DHDN / Gauss-Kruger zone 4) and do the clipping based on vector data with the same projection, the clipping works fine.

ABX
  • 737
  • 12
  • 28