[GRASS-dev] [GRASS GIS] #719: v.edit tool=break: breaking more then 6 coords and producing of an unexpected line

#719: v.edit tool=break: breaking more then 6 coords and producing of an
unexpected line
-------------------------------+--------------------------------------------
Reporter: achim | Owner: grass-dev@lists.osgeo.org
     Type: defect | Status: new
Priority: major | Milestone: 6.5.0
Component: Vector | Version: svn-develbranch6
Keywords: v.edit tool=break | Platform: Unspecified
      Cpu: Unspecified |
-------------------------------+--------------------------------------------
1/2

using v.edit tool=break results for more than 6 coordinates in an error:
"Attempt to delete dead feature".

after error message the topology of vector-file is destroyed:
WARNING: Size of 'coor' file differs from value saved in topology file
WARNING: Please rebuild topology for vector map

two equal coordinates result in an error, too

----

2/2

breaking a line returns three(!) lines: the two desired and one straight
connecting the breaking point and the end or start point of the input-line

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

#719: v.edit tool=break: breaking more then 6 coords and producing of an
unexpected line
--------------------------+-------------------------------------------------
  Reporter: achim | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: major | Milestone: 6.5.0
Component: Vector | Version: svn-develbranch6
Resolution: | Keywords: v.edit tool=break
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Comment (by achim):

2/2

has to do with direction of line. If line direction is flipped, everything
is done alright.

Guess, it has to do with " Vect_append_point" in lines 94, 106, which add
a line to the last! one.?

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

#719: v.edit tool=break: breaking more then 6 coords and producing of an
unexpected line
--------------------------+-------------------------------------------------
  Reporter: achim | Owner: martinl
      Type: defect | Status: assigned
  Priority: major | Milestone: 6.5.0
Component: Vector | Version: svn-develbranch6
Resolution: | Keywords: v.edit tool=break
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Changes (by martinl):

* cc: grass-dev@lists.osgeo.org (added)
  * owner: grass-dev@lists.osgeo.org => martinl
  * status: new => assigned

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

#719: v.edit tool=break: breaking more then 6 coords and producing of an
unexpected line
--------------------------+-------------------------------------------------
  Reporter: achim | Owner: martinl
      Type: defect | Status: assigned
  Priority: major | Milestone: 6.5.0
Component: Vector | Version: svn-develbranch6
Resolution: | Keywords: v.edit tool=break
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Comment (by martinl):

Replying to [ticket:719 achim]:
> 1/2
>
> using v.edit tool=break results for more than 6 coordinates in an error:
"Attempt to delete dead feature".
>
> after error message the topology of vector-file is destroyed:
> WARNING: Size of 'coor' file differs from value saved in topology file
> WARNING: Please rebuild topology for vector map
>
> two equal coordinates result in an error, too
>
> ----
>
> 2/2
>
> breaking a line returns three(!) lines: the two desired and one straight
connecting the breaking point and the end or start point of the input-line

Can you attach testing data to the ticket (e.g. in GRASS ASCII format -
v.out.ascii format=standard) and exact commands to reproduce buggy
behaviour of v.edit? Thanks. Martin

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

#719: v.edit tool=break: breaking more then 6 coords and producing of an
unexpected line
--------------------------+-------------------------------------------------
  Reporter: achim | Owner: martinl
      Type: defect | Status: assigned
  Priority: major | Milestone: 6.5.0
Component: Vector | Version: svn-develbranch6
Resolution: | Keywords: v.edit tool=break
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Comment (by achim):

Hi, I added a code example. Hope it helps... Achim

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

#719: v.edit tool=break: breaking more then 6 coords and producing of an
unexpected line
--------------------------+-------------------------------------------------
  Reporter: achim | Owner: martinl
      Type: defect | Status: assigned
  Priority: major | Milestone: 6.5.0
Component: Vector | Version: svn-develbranch6
Resolution: | Keywords: v.edit tool=break
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Comment (by achim):

Forgot:
its EPSG 4326 at

g.region -p
projection: 3 (Latitude-Longitude)
zone: 0
datum: wgs84
ellipsoid: wgs84
north: 31:27:30N
south: 4:01:30S
west: 23:27E
east: 39:48E
nsres: 0:00:30
ewres: 0:00:30
rows: 4258
cols: 1962
cells: 8354196

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

#719: v.edit tool=break: breaking more then 6 coords and producing of an
unexpected line
-------------------------------+--------------------------------------------
Reporter: achim | Owner: martinl
     Type: defect | Status: assigned
Priority: major | Milestone: 6.5.0
Component: Vector | Version: svn-develbranch6
Keywords: v.edit tool=break | Platform: Unspecified
      Cpu: Unspecified |
-------------------------------+--------------------------------------------

Comment(by GG1234):

Hello all,

I am having the same unexpected additional lines when I brake lines of my
map. Is there any hope for this ticket to be resolved in a near future or
should I find a workaround ?
Has anybody ideas of workarounds ? I tried on PostGis with the ST_Split
function but wasn't lucky at using it, and I would rather stay in GRASS if
possible.

Regards,

Cev.

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

#719: v.edit tool=break: breaking more then 6 coords and producing of an
unexpected line
-------------------------------+--------------------------------------------
Reporter: achim | Owner: martinl
     Type: defect | Status: assigned
Priority: major | Milestone: 6.5.0
Component: Vector | Version: svn-develbranch6
Keywords: v.edit tool=break | Platform: Unspecified
      Cpu: Unspecified |
-------------------------------+--------------------------------------------

Comment(by martinl):

Replying to [comment:6 GG1234]:
> I am having the same unexpected additional lines when I brake lines of
my map. Is there any hope for this ticket to be resolved in a near future
or should I find a workaround ?
> Has anybody ideas of workarounds ? I tried on PostGis with the ST_Split
function but wasn't lucky at using it, and I would rather stay in GRASS if
possible.

I will take a look at this issue during Christmas. No promises that it
will help of course:-) Happy Xmas, Martin

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/719#comment:7&gt;
GRASS GIS <http://grass.osgeo.org>

#719: v.edit tool=break: breaking more then 6 coords and producing of an
unexpected line
-------------------------------+--------------------------------------------
Reporter: achim | Owner: martinl
     Type: defect | Status: assigned
Priority: major | Milestone: 6.5.0
Component: Vector | Version: svn-develbranch6
Keywords: v.edit tool=break | Platform: Unspecified
      Cpu: Unspecified |
-------------------------------+--------------------------------------------

Comment(by martinl):

Replying to [comment:1 achim]:
> 2/2
>
> has to do with direction of line. If line direction is flipped,
everything is done alright.
>
> Guess, it has to do with " Vect_append_point" in lines 94, 106, which
add a line to the last! one.?

hopefully fixed in r58512 (devbr6).

The command breaks both lines (1 and 2)

{{{
v.edit map=network tool=break coords=33.6708333333333,16.9041666666667
}}}

You want probably break only line with id 1

{{{
v.edit map=network tool=break coords=33.6708333333333,16.9041666666667
id=1
}}}

Another option would be to break lines on intersections

{{{
v.clean in=network out=network_break tool=break
}}}

or

{{{
v.edit map=network tool=break id=1-9999
}}}

assuming that the map has less them 10e3 lines.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/719#comment:8&gt;
GRASS GIS <http://grass.osgeo.org>

#719: v.edit tool=break: breaking more then 6 coords and producing of an
unexpected line
-------------------------------+--------------------------------------------
Reporter: achim | Owner: martinl
     Type: defect | Status: assigned
Priority: major | Milestone: 6.5.0
Component: Vector | Version: svn-develbranch6
Keywords: v.edit tool=break | Platform: Unspecified
      Cpu: Unspecified |
-------------------------------+--------------------------------------------

Comment(by martinl):

Breaking lines with multiple coordinate pairs hopefully fixed in r58516
(GRASS 6.5 only). Note that command

{{{
v.edit map=network tool=break
coords=33.6708333333333,16.9041666666667,32.5041666666667,15.6458333333333,33.0208333333333,15.2708333333333
}}}

breaks all lines in given bounding boxes. You probably want to break lines
only on intersections (`v.clean tool=break`)

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/719#comment:9&gt;
GRASS GIS <http://grass.osgeo.org>

#719: v.edit tool=break: breaking more then 6 coords and producing of an
unexpected line
-------------------------------+--------------------------------------------
Reporter: achim | Owner: martinl
     Type: defect | Status: assigned
Priority: major | Milestone: 6.5.0
Component: Vector | Version: svn-develbranch6
Keywords: v.edit tool=break | Platform: Unspecified
      Cpu: Unspecified |
-------------------------------+--------------------------------------------

Comment(by GG1234):

Hello Martin,

I am afraid I still have artifacts, see attached picture.
For further debugging, I attach my layer and a txt files with the points
on which I break.

I didn't try the first described bug yet, but will do so ASAP.

Thanks for the help and Merry Christmas to all,

Cev

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/719#comment:10&gt;
GRASS GIS <http://grass.osgeo.org>

#719: v.edit tool=break: breaking more then 6 coords and producing of an
unexpected line
-------------------------------+--------------------------------------------
Reporter: achim | Owner: martinl
     Type: defect | Status: assigned
Priority: major | Milestone: 6.5.0
Component: Vector | Version: svn-develbranch6
Keywords: v.edit tool=break | Platform: Unspecified
      Cpu: Unspecified |
-------------------------------+--------------------------------------------

Comment(by martinl):

Replying to [comment:10 GG1234]:
> I am afraid I still have artifacts, see attached picture.
> For further debugging, I attach my layer and a txt files with the points
on which I break.

please could you attach also commands to reproduce this bug. I have
imported two shapefiles and created a point map.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/719#comment:11&gt;
GRASS GIS <http://grass.osgeo.org>

#719: v.edit tool=break: breaking more then 6 coords and producing of an
unexpected line
-------------------------------+--------------------------------------------
Reporter: achim | Owner: martinl
     Type: defect | Status: assigned
Priority: major | Milestone: 6.5.0
Component: Vector | Version: svn-develbranch6
Keywords: v.edit tool=break | Platform: Unspecified
      Cpu: Unspecified |
-------------------------------+--------------------------------------------

Comment(by GG1234):

I extracted the commands from the python script I use. Here it is :

{{{
def montest():
         print g.run_command('v.patch', quiet=True, overwrite=True, input =
("Support_2","Raccos"), output="network")
         file = open('Conn_Pt2.txt', 'r')
         resultatParse = file.read()
         file.close()
         resultat = resultatParse.split("\n")
         for macoord in resultat[1:]:
                 print "braking at point "+macoord
                 print g.run_command('v.edit', map = "network", layer=1,
tool = 'break', coords = macoord, thresh=1 ,overwrite=True)
}}}

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

#719: v.edit tool=break: breaking more then 6 coords and producing of an
unexpected line
--------------------------+-------------------------------------------------
  Reporter: achim | Owner: martinl
      Type: defect | Status: closed
  Priority: major | Milestone: 6.5.0
Component: Vector | Version: svn-develbranch6
Resolution: fixed | Keywords: v.edit tool=break
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Changes (by GG1234):

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

Comment:

Thanks to Martin's Christmas present the bugs have vanished.
My previous tests were wrong, I guess my Grass build wasn't recent enough.
With a new setup it works like a charm !

Many thanks to Martin for this bug resolution, I will close the ticket.
Any ideas if the fix is also in Grass 7 or will be in near futur ?

Cev.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/719#comment:13&gt;
GRASS GIS <http://grass.osgeo.org>

#719: v.edit tool=break: breaking more then 6 coords and producing of an
unexpected line
--------------------------+-------------------------------------------------
  Reporter: achim | Owner: martinl
      Type: defect | Status: closed
  Priority: major | Milestone: 6.4.4
Component: Vector | Version: svn-releasebranch64
Resolution: fixed | Keywords: v.edit tool=break
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Changes (by neteler):

  * version: svn-develbranch6 => svn-releasebranch64
  * milestone: 6.5.0 => 6.4.4

Comment:

Replying to [comment:13 GG1234]:
> Many thanks to Martin for this bug resolution, I will close the ticket.
> Any ideas if the fix is also in Grass 7 or will be in near futur ?

Reopening since lacking from G6.4 (two differences) and potentially 7.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/719#comment:14&gt;
GRASS GIS <http://grass.osgeo.org>

#719: v.edit tool=break: breaking more then 6 coords and producing of an
unexpected line
--------------------------+-------------------------------------------------
  Reporter: achim | Owner: martinl
      Type: defect | Status: closed
  Priority: major | Milestone: 6.4.4
Component: Vector | Version: svn-releasebranch64
Resolution: fixed | Keywords: v.edit tool=break
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------

Comment(by martinl):

Replying to [comment:14 neteler]:

> Reopening since lacking from G6.4 (two differences) and potentially 7.

right, backported to `relbr64` as r58933 and r58934. Could anyone test it
(probably GG1234?)? Thanks.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/719#comment:15&gt;
GRASS GIS <http://grass.osgeo.org>