I have clipped the shape I want but it looks messy with ragged edges. I want to remove these and have clean edges.

I have tried doing this on QGIS but have come to the conclusion that it is not possible. Hopefully I am wrong. I have access to QGIS, GIMP photo editor, paint , R and Python. Unfortunately I don't have ArcGIS where I believe it is easily possible.

enter image description here


You can supersample the raster data, i.e. artificially decrease the pixel size (e.g. from 1000 m to 250 m), using a nearest neighbor resampling method and then clip the supersampled raster with your shapefile. The downside is that the size of your raster file is going to increase.

  • Thank you. I used GDAL warp (reproject) but can only seem to increase pixel size and not decrease. Is GDAL Warp (reproject) tool the correct tool? – Tony Brown Jul 29 at 17:20
  • In QGIS, right click the raster layer in the Layers panel and then select Export -> "Save as". There you can change the resolution as you see fit. – pan Jul 29 at 17:25

If your only problem is the messy appearance of the "ragged edges", it might make more sense to hide the raster where it falls outside the polygon. An easy way to do this is with an inverted polygon style.

  1. Right click on your country outline layer > duplicate.

  2. Change the style of the duplicate layer to Inverted polygons, with a white fill and stroke style = no pen.

enter image description here

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.