2

In QGIS, how to clip a raster with a polygon mask, but keep the outer edge cells of the raster touching the mask?

In other words: how to create a one raster cell outer buffer for the masking polygon?

  • 1
    It's probably much easier just to run the buffer tool on the polygon mask layer and increase the extent of that. – Joseph Oct 17 '16 at 10:28
  • 2
    @Joseph but you'd have to buffer it by the diagonal of a cell to catch cells that just touch the polygon by a corner, and that size buffer would also catch cells that don't touch the polygon. – Spacedman Oct 17 '16 at 11:54
1

solved it by creating a buffer first as @Joseph suggested. To get buffer:

ogr2ogr.exe "\"[temporary file]\"" 1402.shp 1402 -dialect sqlite -sql "SELECT ST_Buffer( geometry , 0.001 ),* FROM '1402' "

where, 1402.shp is my mask shapefile and 0.001 is my buffer distance.

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.