[GIS] Clipping a raster with a shape layer fails by returning an empty raster (nan – 0)

clipcoordinate systemqgisraster

I am trying to clip a raster layer by a shape define by a polygon.
(A previous question was about a line layer clipping, whereas this one relates to raster layer)

The resulting layer is however an empty layer. To be more specific the resulting layer is raster of 1846×1202 pixels, but it seems to be filled with no-data value.

I am clipping the raster via menu Raster -> Extract -> Clip

Here are some views of the work:

  1. Polygon Shape (Mask):

    vector shape polygon

  2. Raster Layer to clip

    raster layer to clip

  3. Resulting layer (after clipping): Nothing !

    clipped layer: EMPTY

  4. Layers' icons in QGIS Layer Windows

    Layers' appearances

If I do a clipping using a Extent (rectangular selection) instead of Mask Layer (clipping with shape), it works: so I suspect I have a problem with my polygon layer.

Test with 'Extent' clipping

Best Answer

You can't clip a raster file working with ESPG 3857 (WGS 84 / Pseudo-Mercator).


Here is how you can to it:

  1. Richg click on your rasterfile Save as... chose a UTM CRS (look up the right zone before) eg. EPSG 32632) and save the raster file

  2. do the same for you shapefile you want to use for clipping.

  3. Use the raster clipper with your new files Raster -> Extract -> Clip

clipper

example