I'm trying to cut a CLC raster (several, actually) with a shapefile (polygon) boundary from a country (Portugal, continent only), bu i keep getting this error:

QGIS version: 3.8.2-Zanzibar
QGIS code revision: 4470baa1a3
Qt version: 5.11.2
GDAL version: 2.4.1
GEOS version: 3.7.2-CAPI-1.11.0 b55d2125
PROJ version: Rel. 5.2.0, September 15th, 2018
Processing algorithm…
Algorithm 'Clip raster by mask layer' starting…
Input parameters:
{ 'ALPHA_BAND' : False, 'CROP_TO_CUTLINE' : True, 'DATA_TYPE' : 0, 'INPUT' : 'D:/d_araujo/Documents/SIGs/Dados/CLC/CLC_CHA_12_18/clc2018_cha1218_v2018_20_raster100m/CLC2018_CHA1218_V2018_20.tif', 'KEEP_RESOLUTION' : True, 'MASK' : 'D:/d_araujo/Documents/SIGs/Projetos/UTAD/PROJETO_FINAL_QGIS/DADOS/SHAPE/boundary_continent.shp', 'MULTITHREADING' : False, 'NODATA' : None, 'OPTIONS' : '', 'OUTPUT' : 'TEMPORARY_OUTPUT', 'SET_RESOLUTION' : False, 'SOURCE_CRS' : None, 'TARGET_CRS' : QgsCoordinateReferenceSystem('EPSG:3035'), 'X_RESOLUTION' : None, 'Y_RESOLUTION' : None }

GDAL command:
gdalwarp -t_srs EPSG:3035 -of GTiff -tr 100.0 -100.0 -tap -cutline D:/d_araujo/Documents/SIGs/Projetos/UTAD/PROJETO_FINAL_QGIS/DADOS/SHAPE/boundary_continent.shp -cl boundary_continent -crop_to_cutline D:/d_araujo/Documents/SIGs/Dados/CLC/CLC_CHA_12_18/clc2018_cha1218_v2018_20_raster100m/CLC2018_CHA1218_V2018_20.tif C:/Users/d_araujo/AppData/Local/Temp/processing_fdc14054ef044d2ebbef8d7e8da929b0/50223fb5352f4f44a621aba9eea2a396/OUTPUT.tif
GDAL command output:
Copying raster attribute table from D:/d_araujo/Documents/SIGs/Dados/CLC/CLC_CHA_12_18/clc2018_cha1218_v2018_20_raster100m/CLC2018_CHA1218_V2018_20.tif to new file.

Creating output file that is 3415P x 5686L.

Processing D:/d_araujo/Documents/SIGs/Dados/CLC/CLC_CHA_12_18/clc2018_cha1218_v2018_20_raster100m/CLC2018_CHA1218_V2018_20.tif [1/1] : 0ERROR 1: IllegalArgumentException: point array must contain 0 or >1 elements

ERROR 1: Cutline polygon is invalid.

Using internal nodata values (e.g. 0) for image D:/d_araujo/Documents/SIGs/Dados/CLC/CLC_CHA_12_18/clc2018_cha1218_v2018_20_raster100m/CLC2018_CHA1218_V2018_20.tif.

Copying nodata values from source D:/d_araujo/Documents/SIGs/Dados/CLC/CLC_CHA_12_18/clc2018_cha1218_v2018_20_raster100m/CLC2018_CHA1218_V2018_20.tif to destination C:/Users/d_araujo/AppData/Local/Temp/processing_fdc14054ef044d2ebbef8d7e8da929b0/50223fb5352f4f44a621aba9eea2a396/OUTPUT.tif.

Execution completed in 1.52 seconds
{'OUTPUT': 'C:/Users/d_araujo/AppData/Local/Temp/processing_fdc14054ef044d2ebbef8d7e8da929b0/50223fb5352f4f44a621aba9eea2a396/OUTPUT.tif'}

Loading resulting layers
Algorithm 'Clip raster by mask layer' finished

I feel the problem relies only on the boundary shapefile, but in ArcGIS i've used it sucessfully for various tasks.

I tried Check validity on the shapefile, and with GEOS method it doesn't return any error, and with QGIS method, it just freezes, and doesn't produce any result. I tried Fix geometries, but it returns nothing useful. I tried to buffer with a 0 m distance, and this shape also produces the error above. When i create a new shapefile with a simple rectangle on it, i can cut the CLC with it, so the raster doesn't seem to be the issue.

  • Try recreating the polygon in a new layer, using tracing or snapping.
    – csk
    Aug 27, 2019 at 17:40
  • @csk Thanks, will try that and get back to here
    – d_araujo
    Aug 27, 2019 at 18:43

1 Answer 1


I noticed later that, even being only one feature, there were tiny islands around the boundary, and maybe the issue was in those. But i wasn't able to delete all of them, because i was in a hurry.

So, to solve my issue, i used Simplify, with "Distance (Douglas-Peucker)" method, using a 1km tolerance. Any type of polygon based directly on the original (buffer of 0m, tracing or snapping as sugested by @csk) remained problematic, thus not allowing me to cut the raster. I assume the simplification of the polygon deleted any error present in the feature.

I also need to state that i tried the original polygon (with all the administrative divisions and hundreds of features) and the simple continental boundaries (including those very small islands, they were all in the same feature).

I couldn't find another solution, and given the fact that i simplified the polygon to a 1km tolerance, for my situation there was no problem, but to any other person with the same issue, and in need of greater detail on their project, it might not be the best. But it works!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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