Bug report #4087

Split Features tool: lines are split also at every self-intersection

Added by jcnotter - over 9 years ago. Updated over 1 year ago.

Status:Open
Priority:Normal
Assignee:-
Category:Digitising
Affected QGIS version:3.7(master) Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:14070

Description

When you use this function to a location, it splits the polyline at each intersections on the polyline and you get a lot of polylines and not 2 as you want
Example : for separating the return track, you get many little tracks ...

temp.zip (2.16 KB) jcnotter -, 2011-07-14 09:15 PM

split.zip (8.82 KB) Pedro Venâncio, 2015-09-28 04:50 PM


Related issues

Duplicated by QGIS Application - Bug report #21439: Split Tool: Self-intersecting line is also split at every... Closed 2019-03-01

History

#1 Updated by Paolo Cavallini about 9 years ago

  • Pull Request or Patch supplied set to No

See also #4147

#2 Updated by Paolo Cavallini almost 9 years ago

  • Category set to 44

#3 Updated by Giovanni Manghi almost 9 years ago

  • Target version set to Version 1.7.4

#4 Updated by Giovanni Manghi almost 9 years ago

  • Affected QGIS version set to master
  • Crashes QGIS or corrupts data set to No
  • Subject changed from Split Features to Split Features tool: lines are split also at every self-intersection
  • Assignee set to cfarmer -

#5 Updated by Giovanni Manghi almost 9 years ago

see also #4559

#6 Updated by Richard Duivenvoorde almost 9 years ago

don't know if cfarmer is the right person to assign this issue to??

the split feature tool is part of

int QgsVectorLayer::splitFeatures( const QList<QgsPoint>& splitLine, bool topologicalEditing )

(implemented via geos, not via ftools (for what I can see))

the actual bug is that the line is also split on it's self intersections

#7 Updated by Giovanni Manghi over 8 years ago

  • Priority changed from High to Normal

#8 Updated by Paolo Cavallini over 8 years ago

  • Target version changed from Version 1.7.4 to Version 1.8.0

#9 Updated by Paolo Cavallini about 8 years ago

  • Target version changed from Version 1.8.0 to Version 2.0.0

#10 Updated by Giovanni Manghi over 7 years ago

  • Assignee deleted (cfarmer -)
  • Status changed from Open to Closed
  • Resolution set to worksforme

seems fixed in master, reopen if necessary.

#11 Updated by Richard Duivenvoorde over 7 years ago

  • Status changed from Closed to Reopened

Still not working for me.

If I open the attached shapefile, containing 1 feature (open feature table to see that).

then set layer in edit modus and then from the 'Advanced digitizing toolbar' use the 'split features' tool.

If you then create a 'cut line' in the middle. I would think that the result would be 2 (two) lines.

But if you open the attribute table, it will show you 15 features. Apperently the line is cut on every place where is intersects itself. To me this looks as not what you want.

OR (Giovanni), do we have different settings? And do you have a setting which I do not have...

#12 Updated by Giovanni Manghi over 7 years ago

  • Resolution deleted (worksforme)

#13 Updated by Jürgen Fischer over 6 years ago

  • Category changed from 44 to Digitising

#14 Updated by Jürgen Fischer over 6 years ago

  • Target version changed from Version 2.0.0 to Future Release - Lower Priority

#15 Updated by Brett Russ over 6 years ago

I'm a new QGIS user and thought I was nuts until I found this bug report. I open a single GPX track in QGIS, convert it to a shapefile, and try to split it into two sections. Before the split feature, the attribute table had 1 entry; after: 75 entries! This is impossible to deal with.

Since this defect is so far down the priority list, is there a workaround we could try in cases where we need to split a self intersecting line? I really don't want to trace new lines over the original GPX/SHP for every subsection of the original.

Thanks

#16 Updated by Brett Russ about 6 years ago

I am setting up Mac OS X 10.9.4 to do QGIS development. I could use a tip or two on where to look to try fixing this issue. Thanks in advance.

#17 Updated by Pedro Venâncio about 5 years ago

  • Target version changed from Future Release - Lower Priority to Version 2.12
  • File split.zip added

Hi,

Please make a test with the two layers I am attaching.

The layer trajeto_completo_2.shp has one single line and the layer percurso_pedestre_2.shp has 2 lines.

Try to make a Split feature in each of the layers.

Making split in percurso_pedestre_2.shp, I get 3 lines, as expected.

Making split in trajeto_completo_2.shp, what happens is that the split is done at all points where the lines intersect.

I thought I was with the problem of this ticket, but more strange is that does not always happen, and the layer in this example is the same, it was only made the split of trajeto_completo_2.shp in another software, resulting in percurso_pedestre_2.shp.

Can anyone see any substantial difference between the two shapefiles that allows explain this different behavior?

I think one way to fix this issue would be through "Enable topological editing" option of the Snapping Options. If this option was active, then it should do the split at every self-intersection, as a network topologically should not intersect.
However, for example in the case of road viaducts, the lines can cross without intersect, since they are at different levels. So, for these cases, the "Enable topological editing" option should be deselected.

This approach fails only because there may be the two situations in the same layer, and therefore may not be very worthwhile.

It is best to avoid it to happen, because to make the split at self-intersections will be enough to import the layer into GRASS, that will automatically enforce topology.

In any case, this issue seems to me to have some priority.

#18 Updated by Giovanni Manghi almost 5 years ago

  • Target version deleted (Version 2.12)

#19 Updated by Giovanni Manghi over 3 years ago

  • Regression? set to No
  • Easy fix? set to No

#20 Updated by Giovanni Manghi over 1 year ago

  • Duplicated by Bug report #21439: Split Tool: Self-intersecting line is also split at every intersection added

#21 Updated by Thomas Baumann over 1 year ago

The saga tool "split lines with lines" works fine to split lines even if they have self intersections. Perhaps one of the devs could have a look at the saga source code how they manage to split the lines correctly? http://www.saga-gis.org/saga_tool_doc/2.2.7/shapes_lines_6.html

#22 Updated by Giovanni Manghi over 1 year ago

  • Affected QGIS version changed from master to 3.7(master)
  • Description updated (diff)
  • Status changed from Reopened to Open

#23 Updated by Pedro Venâncio over 1 year ago

Pedro Venâncio wrote:

Hi,

Please make a test with the two layers I am attaching.

The layer trajeto_completo_2.shp has one single line and the layer percurso_pedestre_2.shp has 2 lines.

Try to make a Split feature in each of the layers.

Making split in percurso_pedestre_2.shp, I get 3 lines, as expected.

Making split in trajeto_completo_2.shp, what happens is that the split is done at all points where the lines intersect.

I thought I was with the problem of this ticket, but more strange is that does not always happen, and the layer in this example is the same, it was only made the split of trajeto_completo_2.shp in another software, resulting in percurso_pedestre_2.shp.

Can anyone see any substantial difference between the two shapefiles that allows explain this different behavior?

I think one way to fix this issue would be through "Enable topological editing" option of the Snapping Options. If this option was active, then it should do the split at every self-intersection, as a network topologically should not intersect.
However, for example in the case of road viaducts, the lines can cross without intersect, since they are at different levels. So, for these cases, the "Enable topological editing" option should be deselected.

This approach fails only because there may be the two situations in the same layer, and therefore may not be very worthwhile.

It is best to avoid it to happen, because to make the split at self-intersections will be enough to import the layer into GRASS, that will automatically enforce topology.

In any case, this issue seems to me to have some priority.

This is still true in QGIS 3.x

Also available in: Atom PDF