I am attempting to clip a raster to a shapefile boundary (country boundary, 1 polygon) using the 'clip raster by mask' tool in QGIS v3.8.2. Both layers are in WGS84, so projection mismatch shouldn't be the issue.
I'm getting the following error message that I haven't been able to sort out:
2019-09-09T16:23:13 INFO GDAL execution console output
Creating output file that is 435P x 193L.
Processing R:\exampledata\wc20_25m_tmin_01.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. -3.4e+38) for image R:\exampledata\wc20_25m_tmin_01.tif.
Copying nodata values from source R:\exampledata\wc20_25m_tmin_01.tif to destination C:/Temp/processing_7b281fab84954f6ca3dd66d12d696f5c/0b2ef639021f42f0b744260b98b85235/OUTPUT.tif.
To correct this I've tried:
1) checking the geometry of the polygon file, no errors were found. Geometry is valid
2) correcting the geometry anyway. No change.
3) creating a zero distance buffer, didn't fix it.
4) tried a different vector shapefile, same issue.
5) tried a different raster with both shapefiles, same issue.
6) tried simplifying the geometry, no change to the issue.
7) discovered the single feature is in fact a 'multi polygon'. tried deleteing all the small features and saving the main area as a single polygon. This did not correct the issue.
8) Using the SAGA 'clip raster with polygon' tool. This produces a usable output with a warning:
Loading resulting layers The following layers were not correctly generated.
You can check the 'Log Messages Panel' in QGIS main window to find more information about the execution of the algorithm.
Now, I have tried the same operation in both QGIS 2.18 (Clipper tool) and ArcGIS 10.6 (Clip) and have no issues. I have also managed to get the SAGA 'clip raster with polygon' function to work on this data in QGIS 3.8.2, although it does give a warning that the result was generated incorrectly. Can anyone tell me what's going on?
EDIT: Since posting this question I have also sent the data to a friend who tried the operations using QGIS 3.8.2, 3.4, and 2.18. They found the same thing; that it works in 2.18 but not in 3.4 or 3.8.2.
EDIT 2: tried additional solutions suggested by comments. None have solved the issue.