Geotrek-admin
Geotrek-admin copied to clipboard
Non respect de la topologie lors de l'ajout d'un segment
Lors de l'ajout d'un segment qui croise un autre segment, dans le cas où l'édition des données se fait sous QGIS sans option de snapping, la topologie n'est pas respecté :
- Le segment existant est découpé
- Le segment ajouté n'est pas découpé.
Ce problème n'est en soit pas lié aux options d'accrochage, il n'apparait pas si un noeud est ajouté à l'intersection des deux segments.
It also happens sometimes when using GEOTREK. That's why I am surprised to hear that it worked for you in Geotrek.
Strange.
Is that new?
Always reproduced?
This part is well tested and if it is systematic it should be easy to reproduce in a test...
Not new, will do some tests to see if I reproduce.
Just made a test on our Geotrek demo (http://geotrekdemo.ecrins-parcnational.fr/) and reproduced it.
I created a first path :
Then I created a second one cutting the first one :
The first one was cut by the second one but the second one should also have been cut in two paths :
Weird...
This looks like the most basic usecase. See: https://github.com/makinacorpus/Geotrek/blob/master/geotrek/core/tests/test_path_split.py#L65
Paths are splitted when detecting a ST_INTERSECTS and ST_INTERSECTION (and a ST_RELATED for excluding some cases).
There are some problems to determin if a path is intersected by another (see stackoverflow -> http://stackoverflow.com/questions/33894948/postgis-unwanted-results-with-st-intersects-and-st-crosses )
Bug is investigating, a solution has been found but we are searching why in this case St_INTERSECTS and ST_INTERSECTION are not reliable (postgis or data bug ?) (in facts, postgis says 2 paths are not intersecting (ST_INTERSECTS), but in same time says intersection is not empty (ST_INTERSECTION). This is why paths are not splitted)
From what I could observe, it seems like a float rounding issue, during «snapping» (4 nanometers in the stackoverflow example).
I suggest that you slightly extend the segment length during snapping to make sure it truely touches/crosses the other one. In the example, 1millimeter would be enough :)
Related #1153
The pull request #1576 improves the situation but it seems it makes trek geometries invalid.
Yes I confirm that now when I add a path cutting an existing one with QGIS, both paths are well splitted and the result is 4 paths. It also do the same in Geotrek now.
The problem still happens (not always) in QGIS when you add a path that snaps an existing one. The existing one is not always splitted.
There I had T1, it was splitted when I created T2 in QGIS but not when I created T3, exactly the same way. Can't understand why.
No more reproduced recently.