Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geometry Error SpatiaLite Database #54662

Closed
2 tasks done
Bafometh91 opened this issue Sep 19, 2023 · 2 comments · Fixed by #54734
Closed
2 tasks done

Geometry Error SpatiaLite Database #54662

Bafometh91 opened this issue Sep 19, 2023 · 2 comments · Fixed by #54734
Assignees
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Data Provider Related to specific vector, raster or mesh data providers Digitizing Related to feature digitizing map tools or functionality Regression Something which used to work, but doesn't anymore

Comments

@Bafometh91
Copy link

What is the bug or the crash?

QGIS 3.28 (Firenze). In a multipolygon SpatiaLite vector layer (created in a SpatiaLite database) we used the Fill Ring tool to carve and fill a hole in a polygon. When we hit the save button to save the changes in the multipolygon layer, the filled ring disappears, but it creates a record with NULL geometry in the attribute table. Even if you delete the hole (not filled) created, the record remains in the Attribute Table.
In the DB manager, if we explore the database and the multipolygon layer created, in the Preview the hole is present, and in Table the geometry type will be MULTIPOLYGON for the existing polygon and NULL for the empty ring.
This issue was not present in the previous long-term release.

Steps to reproduce the issue

  • Create a new SpatiaLite database by right-clicking on the Spatialite entry in the Browser tree and selecting Create Database
  • Create a New SpatiaLite Layer (Layer - Create Layer - New SpatiaLite Layer) in the SpatiaLite database just created with Geometry type: MultiPolygon (the Fields list apparently does not make any difference in replicating the issue, so just an integer ID field will suffice but we did not use an "autoincrementing primary key"). In the Advanced Options of the layer, we kept the specified "geometry" in Geometry column, and we removed the option to Create an autoincrementing primary key
  • Edit the new layer (Toggle Editing, yellow pencil icon) and create a polygon (any shape will replicate the error). Give it any ID number
  • Click on the Fill Ring tool in the Advanced digitalizing toolbar and carve a hole in the polygon. Give the filled hole a new ID number
  • Click on the floppy disk icon (Save Layer Edits) near the Toggle Editing to save the changes to the layer
  • The polygon created in the ring should disappear leaving an empty hole. Its record in the Attribute Table should still be there.

Versions

QGIS version
3.28.10-Firenze
QGIS code revision
e2edb9c
Qt version
5.15.3
Python version
3.9.5
GDAL/OGR version
3.7.1
PROJ version
9.2.1
EPSG Registry database version
v10.088 (2023-05-13)
GEOS version
3.12.0-CAPI-1.18.0
SQLite version
3.41.1
PDAL version
2.5.5
PostgreSQL client version
unknown
SpatiaLite version
5.1.0
QWT version
6.1.6
QScintilla2 version
2.13.1
OS version
Windows 10 Version 2009

Active Python plugins
pdokservicesplugin
4.1.1
quick_map_services
0.19.29
db_manager
0.1.20
grassprovider
2.12.99
MetaSearch
0.3.6
processing
2.12.99
sagaprovider
2.12.99

Supported QGIS version

  • I'm running a supported QGIS version according to the roadmap.

New profile

Additional context

No response

@Bafometh91 Bafometh91 added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Sep 19, 2023
@agiudiceandrea agiudiceandrea added Data Provider Related to specific vector, raster or mesh data providers Regression Something which used to work, but doesn't anymore Digitizing Related to feature digitizing map tools or functionality labels Sep 20, 2023
@agiudiceandrea
Copy link
Contributor

agiudiceandrea commented Sep 20, 2023

I can confirm that the issue occurs using QGIS 3.28 and QGIS 3.33.0-Master on Windows, while it doesn't occur using QGIS 3.22.10 on the same system.

The issue only occurs editing the layer automatically added to the map after it was created: in this case the layer properties window reports Provider: "spatialite" - Storage: "SQLite database with SpatiaLite extension".
The issue doesn't occur if you remove the layer automatically added to the map and then import it just dragging and dropping it to the map or using the Data Source Manager -> Vector dialog window: in this case the layer properties window reports Provider: "ogr" - Storage: "SQLite".

@elpaso
Copy link
Contributor

elpaso commented Sep 22, 2023

I can confirm that the issue occurs using QGIS 3.28 and QGIS 3.33.0-Master on Windows, while it doesn't occur using QGIS 3.22.10 on the same system.

The issue only occurs editing the layer automatically added to the map after it was created: in this case the layer properties window reports Provider: "spatialite" - Storage: "SQLite database with SpatiaLite extension". The issue doesn't occur if you remove the layer automatically added to the map and then import it just dragging and dropping it to the map or using the Data Source Manager -> Vector dialog window: in this case the layer properties window reports Provider: "ogr" - Storage: "SQLite".

This means that the error comes from the 'spatialite' provider and not from 'ogr'.

@elpaso elpaso self-assigned this Sep 25, 2023
elpaso added a commit to elpaso/QGIS that referenced this issue Sep 25, 2023
Fix qgis#54662

Logic shamelessly copied from potgres provider.
elpaso added a commit to elpaso/QGIS that referenced this issue Sep 30, 2023
Fix qgis#54662

Logic shamelessly copied from potgres provider.
elpaso added a commit to elpaso/QGIS that referenced this issue Oct 5, 2023
Manual backport of qgis#54734

Fix qgis#54662

Logic shamelessly copied from potgres provider.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Data Provider Related to specific vector, raster or mesh data providers Digitizing Related to feature digitizing map tools or functionality Regression Something which used to work, but doesn't anymore
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants