qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.65k stars 3.01k forks source link

GDAL Clip Raster by Layer Mask fails when given GeoPackage layer with diacritics (accents) in the name #59573

Open hernanrr opened 1 day ago

hernanrr commented 1 day ago

What is the bug or the crash?

In version 3.40, upon trying to clip a raster by layer mask using a GeoPackage Polygon layer with an accent in the name (e.g., "Frontera zona de interés", GDAL Warp routine fails giving the following error: ERROR 1: Failed to identify source layer from datasource. Process returned error code 1

Below the complete error log:

GDAL command:
gdalwarp -overwrite -of GTiff -tr 30.0 -30.0 -tap -cutline "/Users/ricardo/Documents/GIS/LaSiembra/Tutorial La Siembra.gpkg" -cl "Frontera zona de interés" -crop_to_cutline "/Users/ricardo/Documents/GIS/LaSiembra/DEM Reproyectado.tif" "/Users/ricardo/Documents/GIS/LaSiembra/DEM Reproyectado-cortado2.tif"
GDAL command output:
ERROR 1: Failed to identify source layer from datasource.
Process returned error code 1
Execution completed in 0.34 seconds
Results:
  OUTPUT: /Users/ricardo/Documents/GIS/LaSiembra/DEM Reproyectado-cortado2.tif

Loading resulting layers
The following layers were not correctly generated.
• /Users/ricardo/Documents/GIS/LaSiembra/DEM Reproyectado-cortado2.tif
You can check the 'Log Messages Panel' in QGIS main window to find more information about the execution of the algorithm.

The process works in the following cases:

Steps to reproduce the issue

The error can be reproduced as follows:

  1. Load a raster layer in a projected CRS. In my case it's an SRTM tile in EPSG:32619.
  2. Create a GeoPackage Layer of Polygon Geometry type. Name the Table something with accents. In my case, I named it "Área de Interés". Set the CRS as that of the project.
  3. Digitize a polygon over the raster image. Save it.
  4. Go to Raster -> Extraction -> Clip Raster by Mask Layer...
  5. Select the Raster as the Input Layer
  6. Select the Polygon layer as Mask layer
  7. Check the Keep resolution of input raster box
  8. Set the Output Clipped (mask) to a GeoTiff.
  9. Run.
  10. See error

Here's a screencast of the error in my machine:

https://github.com/user-attachments/assets/c687a1a3-db0b-4454-afd5-56e25e791eda

Versions

QGIS version3.40.0-Bratislava
QGIS code revision1d561ad8ad9
 
Libraries
Qt version5.15.2
Python version3.9.5
GDAL/OGR version3.3.2
PROJ version8.1.1
EPSG Registry database versionv10.028 (2021-07-07)
GEOS version3.9.1-CAPI-1.14.2
SQLite version3.35.2
PDAL version2.3.0
PostgreSQL client versionunknown
SpatiaLite version5.0.1
QWT version6.1.6
QScintilla2 version2.11.5
OS versionmacOS 15.1
 
Active Python plugins
QuickOSM2.2.3
profiletool4.2.6
DataPlotly4.2.0
quick_map_services0.19.36
QWater3.3.2
SRTM-Downloader3.2.3
pointsamplingtool0.5.4
processing2.12.99
grassprovider2.12.99
db_manager0.1.20
MetaSearch0.3.6

Supported QGIS version

New profile

Additional context

This is running in macOS 15.1.1 (24B91) Sequoia

agiudiceandrea commented 5 hours ago

@hernanrr, thanks for reporting. I cannot replicate the issue running QGIS on Windows. I guess the issue may be due to the 3 years old version of the GDAL/OGR library used by QGIS installed via the official dmg installer. You can check it verifying if the issue occurs also running the same gdalwarp command in the macOS terminal inside the QGIS installation bin folder. Some alternative QGIS installation methods for macOS, shipping up-to-date version of the GDAL/OGR library, are: