[GRASS-dev] v.clean tool=break fails

Hi all,

recently I found problem when breaking lines using `v.clean`.

I have a patched map that contains boundaries and centroids.

$ v.info x3 -t
nodes=8219
points=0
lines=0
boundaries=11807
centroids=4876
areas=4875
islands=1222
primitives=16683
map3d=0

When I try to break lines on intersections `v.clean` fails because it
tries to read nodes from centroids (which obviously fails).

$ v.clean in=x3 out=x4 tool=break --o
...
Tool: Break lines at intersections
0..ERROR: Nodes not available for line 11725

Defining `type` explicitly helps

$ v.clean in=x3 out=x4 tool=break --o type=boundary

In the attachment you can find a patch which seems to fix this issue.
I am just not sure about possible side-efects.

Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

(attachments)

break_lines.diff (684 Bytes)

On Sat, Nov 30, 2013 at 12:26 PM, Martin Landa <landa.martin@gmail.com> wrote:

Hi all,

recently I found problem when breaking lines using `v.clean`.

I have a patched map that contains boundaries and centroids.

$ v.info x3 -t
nodes=8219
points=0
lines=0
boundaries=11807
centroids=4876
areas=4875
islands=1222
primitives=16683
map3d=0

When I try to break lines on intersections `v.clean` fails because it
tries to read nodes from centroids (which obviously fails).

$ v.clean in=x3 out=x4 tool=break --o
...
Tool: Break lines at intersections
0..ERROR: Nodes not available for line 11725

Defining `type` explicitly helps

$ v.clean in=x3 out=x4 tool=break --o type=boundary

Fixed in r58340, please test.

Markus M

Hi Markus,

2013/11/30 Markus Metz <markus.metz.giswork@gmail.com>:

[...]

Tool: Break lines at intersections
0..ERROR: Nodes not available for line 11725

Defining `type` explicitly helps

$ v.clean in=x3 out=x4 tool=break --o type=boundary

Fixed in r58340, please test.

thanks for super-quick fix! It seems to be OK, I found similar problem
in `merge_lines.c` (see the attached patch).

Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

(attachments)

merge_lines.diff (408 Bytes)

On Sat, Nov 30, 2013 at 6:02 PM, Martin Landa <landa.martin@gmail.com> wrote:

Hi Markus,

2013/11/30 Markus Metz <markus.metz.giswork@gmail.com>:

[...]

Tool: Break lines at intersections
0..ERROR: Nodes not available for line 11725

Defining `type` explicitly helps

$ v.clean in=x3 out=x4 tool=break --o type=boundary

Fixed in r58340, please test.

thanks for super-quick fix! It seems to be OK, I found similar problem
in `merge_lines.c` (see the attached patch).

Fixed in r58341 (it's the same fix as for breaking lines).

Markus M

On Sat, Nov 30, 2013 at 6:02 PM, Martin Landa <landa.martin@gmail.com> wrote:

Hi Markus,

2013/11/30 Markus Metz <markus.metz.giswork@gmail.com>:

[...]

Tool: Break lines at intersections
0..ERROR: Nodes not available for line 11725

Defining `type` explicitly helps

$ v.clean in=x3 out=x4 tool=break --o type=boundary

Fixed in r58340, please test.

thanks for super-quick fix! It seems to be OK, I found similar problem
in `merge_lines.c` (see the attached patch).

How did you discover that bug in Vect_merge_lines()? To my knowledge
all modules calling Vect_merge_lines() set the correct type (lines
and/or boundaries).

Markus M

Hi Markus,

2013/11/30 Markus Metz <markus.metz.giswork@gmail.com>:

How did you discover that bug in Vect_merge_lines()? To my knowledge
all modules calling Vect_merge_lines() set the correct type (lines
and/or boundaries).

by `v.clean tool=snap -c`, see [1].

Martin

[1] http://trac.osgeo.org/grass/browser/grass/trunk/vector/v.clean/main.c#L407

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

On Mon, Dec 2, 2013 at 4:21 AM, Martin Landa <landa.martin@gmail.com> wrote:

Hi Markus,

2013/11/30 Markus Metz <markus.metz.giswork@gmail.com>:

How did you discover that bug in Vect_merge_lines()? To my knowledge
all modules calling Vect_merge_lines() set the correct type (lines
and/or boundaries).

by `v.clean tool=snap -c`, see [1].

Oops. Thanks for spotting this!

Markus M

Martin

[1] http://trac.osgeo.org/grass/browser/grass/trunk/vector/v.clean/main.c#L407