Saturday, 7 July 2018

Can't cut raster with a polygon shapefile


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
Results:
{'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.




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...