-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Rubberband/snapping using old nodes if a geometry is modified outside QGIS #57784
Comments
This seems like a duplicate of #31251 Since you're working with PostGIS data, you should be able to overcome that by using the postgres |
In fact, there is no way to know when the underlying data provider has changed the geometry on his side... QGIS can't emit a signal, because nothing is triggered in QGIS by this specific underlying change.
+1 with using postgres NOTIFY command, see details on my comment here |
Another solution is to check the layer itself in In this way, every change on the layer will trigger a full refresh of the data, caches, and rubber bands. |
Thank you for your replies! If we use a PostGIS data source using NOTIFY in the trigger function is indeed an option. @Djedouas I wasn't able to make this dependency solution work in 3.38.2. I would have assumed that QGIS can't get a trigger when data changes underneath. Is there something I'm missing? |
🤔 Hmm there is potentially a bug here. I reopen the issue, because I can reproduce the problem, I can't get the dependency working as it should (i.e. reload data and refresh cache and everything each time the layer is saved). |
What is the bug or the crash?
If a geometry is modified in a database after saving layer edits in QGIS the geometry isn't updated in edit/snapping layers.
In the example case below, there is a PostGIS table with a trigger that makes a translation for each row inserted or updated on the table. The polygon itself is updated in QGIS correctly but the edit/snapping layer has still the old geometry. This causes most probably for example the issue described in #57181.
Steps to reproduce the issue
Open the table in QGIS.
Start editing.
Digitize a polygon.
Save layer edits.
Move one vertex (or modify existing geometry some other way).
Save layer edits.
The polygon is shown correctly but for example the vertex tool and snapping use old coordinates.
Versions
<style type="text/css"> p, li { white-space: pre-wrap; } </style>Active Python plugins
processing
2.12.99
grassprovider
2.12.99
db_manager
0.1.20
MetaSearch
0.3.6
Supported QGIS version
New profile
Additional context
It seems that the bug is caused by QgsPointLocator that doesn't get the modified geometry. When a new feature is added the corresponding geometry is added to QgsPointLocator in the function onFeatureAdded().
QGIS/src/core/qgspointlocator.cpp
Lines 1261 to 1277 in 29bb194
When modifying an existing geometry this isn't handled. I'm not sure about the most feasible solution. One solution could be emitting a signal for the changed geometry in QgsVectorLayerEditBuffer::commitChangesChangeAttributes() but still we would need to ensure that QgsPointLocator gets the modified geometry.
The text was updated successfully, but these errors were encountered: