Geotrek-admin icon indicating copy to clipboard operation
Geotrek-admin copied to clipboard

Non respect de la topologie lors de l'ajout d'un segment

Open amandine-sahl opened this issue 9 years ago • 11 comments

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.

pb_saisie_troncon

amandine-sahl avatar Jun 22 '15 14:06 amandine-sahl

It also happens sometimes when using GEOTREK. That's why I am surprised to hear that it worked for you in Geotrek.

camillemonchicourt avatar Sep 25 '15 18:09 camillemonchicourt

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...

leplatrem avatar Sep 25 '15 19:09 leplatrem

Not new, will do some tests to see if I reproduce.

camillemonchicourt avatar Sep 25 '15 19:09 camillemonchicourt

Just made a test on our Geotrek demo (http://geotrekdemo.ecrins-parcnational.fr/) and reproduced it.

I created a first path :

01

Then I created a second one cutting the first one :

02

The first one was cut by the second one but the second one should also have been cut in two paths :

03

04

camillemonchicourt avatar Sep 25 '15 19:09 camillemonchicourt

Weird...

This looks like the most basic usecase. See: https://github.com/makinacorpus/Geotrek/blob/master/geotrek/core/tests/test_path_split.py#L65

leplatrem avatar Sep 25 '15 20:09 leplatrem

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)

submarcos avatar Dec 07 '15 10:12 submarcos

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 :)

capture d ecran de 2016-01-04 13-38-15

leplatrem avatar Jan 04 '16 13:01 leplatrem

Related #1153

leplatrem avatar Jan 16 '16 14:01 leplatrem

The pull request #1576 improves the situation but it seems it makes trek geometries invalid.

gutard avatar Feb 18 '16 17:02 gutard

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.

path-split

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.

camillemonchicourt avatar Aug 09 '16 15:08 camillemonchicourt

No more reproduced recently.

camillemonchicourt avatar Nov 26 '21 21:11 camillemonchicourt