Skip to content

Invalid feature is saved inspite of failing geometry check #67470

Description

@thunwal

What is the bug or the crash?

With the geometry check "Is valid" enabled on a layer, an invalid feature is written to the database anyway.

This is contrary to the QGIS Documentation, which states: "Immediately after any geometry modification, failures in these checks are reported to the user in the Geometry validation panel. As long as a check is failing, it is not possible to save the layer".

Depending on the project transaction mode, the feedback to the user differs (see steps to reproduce). The behaviour should not differ as to per my opinion, and I expect it to be as follows:

  • When creating/modifying: Geometry validation panel opens, listing validation error(s)
  • When saving layer edits: Reject save and show message bar (I'd prefer WARN over INFO)

Steps to reproduce the issue

With the project transaction mode set to "Automatic transaction groups", saving a self-intersecting polygon triggers the following behaviour:

  • blue message bar "Geometry check: Geometry errors have been found. Please fix the errors before saving the layer."
  • error(s) listed in the Geometry validation panel
  • "Save layer edits" button still enabled, and the layer still marked as modified
  • when toggling editing, "Discard" does not remove the polygon.

With the project transaction mode set to "Buffered transaction groups", saving a self-intersecting polygon triggers the following behaviour:

  • no message bar
  • error(s) listed in the Geometry validation panel
  • "Save layer edits" disabled, and the layer no longer marked as modified
  • when toggling editing, no "Discard" option.

Versions

I reproduced the issue with 3.40.9 and 4.2.1.

QGIS-Version4.2.1-Belém do Pará
QGIS-Codeversionf229b86a9c1
 
Bibliotheken
Qt-Version6.11.1
Python-Version3.12.13
GDAL-Version3.13.2 — Iowa City
PROJ-Version9.8.1
EPSG-Registraturdatenbankversion ()
GEOS-Version3.14.1-CAPI-1.20.5
SFCGAL-Version2.3.0
GeographicLib-Version2.7.0
SQLite-Version3.53.4
PDAL-Version2.10.0
PostgreSQL-Client-Version18.4
SpatiaLite-Version5.1.0
QWT-Version6.3.0
QScintilla2-Version2.14.1
OpenGL-Version4.3 (Kompatibilitätsprofil), Intel(R) Iris(R) Xe Graphics
BS-VersionWindows 11 Version 24H2
 
Aktive Python-Erweiterungen
QgisModelBakerv8.3.10
db_manager0.1.20
linking_relation_editorv1.5.0
processing2.12.99
solocator2.0.0

Supported QGIS version

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

New profile

No Duplicate of the Issue

  • I have verified that there are no existing issues raised related to my problem.

Additional context

Probably related to #67468

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugEither a bug report, or a bug fix. Let's hope for the latter!

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions