network editing
Opened this issue · 4 comments
I was discussing this with @d2hydro. To derive an accurate network topology from a HyDAMO GeoPackage, small fixes are often needed, for instance to:
- snap lines onto vertices
- invert line directions
Fixes should generally be done by the data provider, however for speed it is often tempting to do them manually. I'm assuming errors here that are difficult to fully automate. For reproducibility, preferably any modifications are done in code. This is often more work than manual edits however.
What are good ways to track manual fixes to a GeoPackage? If we can somehow capture the SQL statements that QGIS sends to SQLite to update the tables, that would be a good option. I don't see such an option in QGIS however.
- Perhaps we can create triggers that log certain changes to a logging table in the GeoPackage.
- QGIS/SQLite uses Write-Ahead Logging (file extension .gpkg-wal) to store all the edits. Only when the connection is closed, are these changes committed to the original .gpkg. Perhaps we can use these in some way.
I just found this while writing this issue, but SQLite also distributes sqldiff.exe: Database Difference Utility. I tried the output after reversing a single edge, and it shows like this:
❯ c:\bin\sqlite\sqldiff.exe basic.gpkg basic-v2.gpkg
UPDATE Edge SET geom=x'4750000340710000000000000000184000000000000018400000000000000000000000000000f03f0102000000020000000000000000001840000000000000f03f00000000000018400000000000000000' WHERE fid=17;
UPDATE gpkg_contents SET last_change='2023-09-21T13:52:07.160Z', min_x=5.04870979341447e-19 WHERE rowid=2;
sqldiff can be downloaded from https://www.sqlite.org/download.html.
Two more functions:
- Validate (and) correct wrong geometry-types (!= LineStrings, mostly MultiLinestrings)
- Add a new LineString between 2 nodes
- Split a LineString (adding a node)
Can conversion from MultiLineString to LineString not be automated?
And regarding adding a new LineString between 2 nodes, what do you expect besides the default tools that QGIS offers?
For splitting a LineString to put a node in between, are you thinking about editing Ribasim networks here? I agree that would be useful. Perhaps for the QGIS plugin.
For reference, Ribasim 7 allows you to select a node and edge type, and then supports the following operations. Split connection is there as well.
- auto-conversion; yes it can, but for HydroObjects you want to feedback to the Water Authority which feature-types you've converted otherwise you'll receive the same wrong-types again
- functionality; yes I was having Netter (Ribasim7/Sobek2 interface) in the back of my mind. I think you do want to split HydroObjects adding a node and force the user to draw a new HydroObject between two nodes . That is what I had to do for adding this HydroObject as a link between two nodes:
linked issue #11. Similar functionality, but on HyDAMO-class in stead via QGIS Plugin.