[GRASS-dev] [GRASS GIS] #3319: v.overlay: incorrect results with "not" operator

#3319: v.overlay: incorrect results with "not" operator
-------------------------+---------------------------------
Reporter: sbl | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 7.2.1
Component: Vector | Version: svn-releasebranch72
Keywords: v.overlay | CPU: Unspecified
Platform: Unspecified |
-------------------------+---------------------------------
In a project I want to clip away the sections from a river network that
are within lakes.

Unfortunately, some streams vanished from the result completely (which
should not)...

Data is here (sorry it is 5-11 MB):
http://vm-srv-finstad.vm.ntnu.no/vpack/

The failing command I tried was:
v.overlay --overwrite --verbose ainput=Streams_WR14695_merge
binput=Lakes_WR14695_erings operator=not output=Streams_WR14695_test

Tested on three different boxes, with GRASS 7.2.1svn, 7.0.6svn and trunk.

Lines that disappear are e.g.:
cat
8725
15481

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3319&gt;
GRASS GIS <https://grass.osgeo.org>

#3319: v.overlay: incorrect results with "not" operator
--------------------------+---------------------------------
  Reporter: sbl | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: major | Milestone: 7.2.1
Component: Vector | Version: svn-releasebranch72
Resolution: | Keywords: v.overlay
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------

Comment (by mmetz):

Replying to [ticket:3319 sbl]:
> In a project I want to clip away the sections from a river network that
are within lakes.
>
> Unfortunately, some streams vanished from the result completely (which
should not)...

Please try v.overlay in trunk r70800.

The problem lies with Vect_break_lines() and Vect_break_lines_list() which
create new vertices that are sometimes too close to existing vertices
(floating point representation error). Radim was aware of that problem in
v.overlay. I (hopefully) fixed the symptom in v.overlay. The real fix
would be to not use a fixed value for rethresh (Radim was also aware of
that problem) in Vect_line_intersection() and Vect_line_intersection2(),
but instead set rethresh to the smallest representable difference (ULP).

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3319#comment:1&gt;
GRASS GIS <https://grass.osgeo.org>

#3319: v.overlay: incorrect results with "not" operator
--------------------------+---------------------------------
  Reporter: sbl | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: major | Milestone: 7.2.1
Component: Vector | Version: svn-releasebranch72
Resolution: | Keywords: v.overlay
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------

Comment (by sbl):

Thanks Markus for looking into this! \\
I just tested and after a visual inspection of the results the issue looks
fixed. \\
Will you backport it or do you want me to test more systemically before
backporting?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3319#comment:2&gt;
GRASS GIS <https://grass.osgeo.org>

#3319: v.overlay: incorrect results with "not" operator
--------------------------+---------------------------------
  Reporter: sbl | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.1
Component: Vector | Version: svn-releasebranch72
Resolution: | Keywords: v.overlay
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------
Changes (by mmetz):

* priority: major => normal

Comment:

Replying to [comment:2 sbl]:
> Thanks Markus for looking into this! \\
> I just tested and after a visual inspection of the results the issue
looks fixed. \\
> Will you backport it or do you want me to test more systemically before
backporting?

I have backported the fix to relbr72 in r70703. In theory it is still
possible that lines are missing or are kept erroneously, but this would
require more substantial fixes to Vect_break_line() and
Vect_break_line_list(). Reducing priority.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3319#comment:3&gt;
GRASS GIS <https://grass.osgeo.org>

#3319: v.overlay: incorrect results with "not" operator
--------------------------+---------------------------------
  Reporter: sbl | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.1
Component: Vector | Version: svn-releasebranch72
Resolution: | Keywords: v.overlay
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------

Comment (by mlennert):

I would actually suggest to close this and open a new ticket if others
errors come up.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3319#comment:4&gt;
GRASS GIS <https://grass.osgeo.org>

#3319: v.overlay: incorrect results with "not" operator
--------------------------+---------------------------------
  Reporter: sbl | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.4.0
Component: Vector | Version: svn-releasebranch72
Resolution: | Keywords: v.overlay
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------
Changes (by sbl):

* milestone: 7.2.1 => 7.4.0

Comment:

In the particular case where I stumbled upon the issue, the fix seem to
cover all cases.\\
However, if these errors still can occur, it is probably only a question
of the number of features processed if the problem shows up?\\
Thus, I would probably prefer to keep it open and re-target. But of course
I would not object if you close it...

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3319#comment:5&gt;
GRASS GIS <https://grass.osgeo.org>

#3319: v.overlay: incorrect results with "not" operator
--------------------------+---------------------------------
  Reporter: sbl | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: minor | Milestone: 7.4.0
Component: Vector | Version: svn-releasebranch72
Resolution: | Keywords: v.overlay
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------
Changes (by mlennert):

* priority: normal => minor

Comment:

This only bites in rare corner cases, so degrading priority to minor.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3319#comment:6&gt;
GRASS GIS <https://grass.osgeo.org>

#3319: v.overlay: incorrect results with "not" operator
--------------------------+---------------------------------
  Reporter: sbl | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: minor | Milestone: 7.4.5
Component: Vector | Version: svn-releasebranch72
Resolution: fixed | Keywords: v.overlay
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------
Changes (by sbl):

* status: new => closed
* resolution: => fixed

Comment:

I have not come across more cases where this pops up.
So, closing it.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3319#comment:12&gt;
GRASS GIS <https://grass.osgeo.org>