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.5k stars 2.99k forks source link

Intersection of points and polygons with one field doesn't work well if result saved to GeoPackage #32927

Closed phidrho closed 4 years ago

phidrho commented 4 years ago

Describe the bug When doing an intersection between two vector layers (I tried with point and polygon layers, it is possible that it doesn't work well with other combinations of vector layers), if only one field was chosen to keep from source layer, after intersection algorithm and file type for result chosen to be geopackage layer (either inside existing geopackage db, or new one) - resulting layer doesn't contain data from chosen input field.

How to Reproduce Geopackage file for testing: qgis_bug.zip

see video: YouTube - QGIS GPKG intersecton bug

QGIS and OS versions Windows 10 Pro, version 1903

QGIS version 3.10.0-A Coruña QGIS code revision 6ffa89eb3e Compiled against Qt 5.11.2 Running against Qt 5.11.2 Compiled against GDAL/OGR 3.0.2 Running against GDAL/OGR 3.0.2 Compiled against GEOS 3.8.0-CAPI-1.13.1 Running against GEOS 3.8.0-CAPI-1.13.1 Compiled against SQLite 3.29.0 Running against SQLite 3.29.0 PostgreSQL Client Version 11.5 SpatiaLite Version 4.3.0 QWT Version 6.1.3 QScintilla2 Version 2.10.8 Compiled against PROJ 6.2.1 Running against PROJ Rel. 6.2.1, November 1st, 2019 OS Version Windows 10 (10.0) Active python plugins gml_application_schema_toolbox; LAStools; mmqgis; db_manager; MetaSearch; processing

Additional context

gioman commented 4 years ago

Confirmed also on 3.4. Works as expected when outputting to temp layer and shapefile. Not when saving to GPKG to a specific file/location.

elpaso commented 4 years ago

The bug is here: https://github.com/qgis/QGIS/blame/74a6871d9e515b2118ee7e43f078c16ed3521745/src/core/qgsvectorlayerexporter.cpp#L124

elpaso commented 4 years ago

@gioman in 3.4 too? The code that introduced the bug looks landed in 3.6 (but I might be wrong)

gioman commented 4 years ago

@gioman in 3.4 too?

@elpaso yes I tested on the latest 3.4