Opened 8 years ago

Last modified 5 years ago

#2903 new defect

v.edit break bug with multiple coordinates

Reported by: robert17 Owned by: grass-dev@…
Priority: normal Milestone: 7.6.2
Component: Vector Version: 7.0.3
Keywords: Cc: jradinger
CPU: OSX/PPC Platform: All

Description

Hello all,

I tried to use the v.edit tool=break with several coords but it doesn't work, although it works with each coord seperately.

More precisely, when I break one line on two coordinates, it creates several superimposed lines each one broken on a coordinate. Whereas the desired output should be one line broken at each coordinate.

Tested on GRASS7 through Win (OSGEO4W) and Debian Below the commands to reproduce the bug :

v.in.ogr input= output= v.edit map= tool=break threshold=0.01 coords=x,y,x,y v.out.ogr input= output=

Thanks for the help, Dannick

Attachments (3)

bug v.edit.png (21.5 KB ) - added by robert17 8 years ago.
bug v.edit.png.zip (18.8 KB ) - added by robert17 8 years ago.
test_vedit_break_shp.zip (1.2 KB ) - added by jimmy 8 years ago.

Download all attachments as: .zip

Change History (12)

by robert17, 8 years ago

Attachment: bug v.edit.png added

by robert17, 8 years ago

Attachment: bug v.edit.png.zip added

comment:1 by martinl, 8 years ago

Can you reproduce error on North Carolina dataset? If so please send exact commands.

Version 0, edited 8 years ago by martinl (next)

comment:2 by jimmy, 8 years ago

Hello,

I think i have the same bug. Using grass 7.0.3 on MacOS, i created a simple vector layer containing a simple line. The projection system is EPSG:2154. http://i.imgur.com/xpIXaKf.png

I then tried to break it using this v.edit command:

v.edit --overwrite --verbose map=testeditbreak@Jimmy tool=break threshold=0.1,0,0 ids=1 coords=3722.5895,-4456546.5289,3443.3747,-4456366.5145

Result in the command line (http://i.imgur.com/wQupaCQ.png)

Then http://i.imgur.com/FoAACzn.png show the attribute table with 4 lines all of the same lenght.

by jimmy, 8 years ago

Attachment: test_vedit_break_shp.zip added

comment:3 by jimmy, 8 years ago

Hello,

Any ideas on this issues? Do you need more information?

comment:4 by martinl, 8 years ago

Milestone: 7.0.47.0.5

comment:5 by neteler, 8 years ago

Milestone: 7.0.57.0.6

comment:6 by neteler, 6 years ago

Milestone: 7.0.67.0.7

comment:7 by jradinger, 6 years ago

It seems that this issue is not yet solved?!

I just had similar problems using v.edit tool=break. Tested with version 7.4.1 (r72807M) and 7.5SVN (r73007M) and MacOS. Trying to break a line vector map at multiple coordinates using v.edit causes that some of the line features might not get broken (I don't know why). Then I can run v.edit tool=break a second time which causes an overlay of the old line feature with the two broken parts (so in sum three lines, that can be identified using the gui query tool). This happens not for all lines/coordinates; however I couldn't identify a common pattern that might cause these errors.

Here an example with the NC dataset were I can at least reproduce the error of getting mulitple overlayed lines when using the break tool (have a look at the railroad line feature with the orig cat 3231):

from grass.script import core as grass

# Copy data from PERMANENT mapset
grass.run_command("g.copy",
    overwrite=True,
    vector="railroads@PERMANENT,railroads")
grass.run_command("v.extract",
    overwrite=True,
    input="firestations@PERMANENT",
    cat="58,66,29,35,31,32",
    output="firestations")

# Connectors to find exact break points coords
grass.run_command("v.distance",
    overwrite=True,
    to="railroads",
    from_="firestations",
    output="firestations_connectors")
firestations_connectors_coors = grass.read_command("v.to.db",
    flags="p",
    map="firestations_connectors",
    option="end",
    separator="comma").splitlines()
firestations_connectors_coors = [[",".join(x.split(",")[1:3])] for x in firestations_connectors_coors[1:]]

# Break at point coords
grass.run_command("v.edit",
      tool="break",
      map="railroads",
      coords=firestations_connectors_coors,
      threshold=50,
      layer=1,
      cats="1-99999999")

A workaround would be to loop over the single coordinate pairs and break the line vector by each pair separately (however, this is comparably very slow):

for i in firestations_connectors_coors:
    grass.run_command("v.edit",
          tool="break",
          map="railroads_2",
          coords=i[0],
          threshold=50,
          layer=1,
          cats="1-99999999")
grass.run_command("v.category",
    input="railroads_2",
    option="add",
    output="railroads_2a",
    layer=2)
Last edited 6 years ago by jradinger (previous) (diff)

comment:8 by jradinger, 6 years ago

Cc: jradinger added

comment:9 by martinl, 5 years ago

Milestone: 7.0.77.6.2
Note: See TracTickets for help on using tickets.