qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.39k stars 2.98k forks source link

Trim/Extend tool should split intersected line segment #49787

Open dgreenewalt opened 2 years ago

dgreenewalt commented 2 years ago

Feature description

I an very pleased with the trim/Extend tool (especially now that I know to toggle snap to segment). I think the intersected line should be split by the tool. It currently adds a vertex to the line where the trimmed line node is moved to. For proper topology to be maintained, the 2 lines should become 3.

Additional context

If other users prefer not to automatically split the line, could there be an optional setting somewhere to toggle this on and off extend ?

uclaros commented 2 years ago

Topology is preserved with the vertex addition. What you suggest would be quite unusual and would definitely introduce problems with default/unique values on the split features.

dgreenewalt commented 2 years ago

My apologies for the confusing diagram. The second set of lines shows the results of the extend tool, with the top line selected, thus the yellow selection color. The bottom set of lines shows the results of splitting the top line, and selecting it - only the right side is selected (yellow) because it was split. I have attempted a better diagram below. extend2 I don't see this as unusual at all. Splitting a line where it overlaps (intersects) another line seems to me as a clean data. The attributes would not change for the split line. "Split Lines By Maximum Length" maintains the line attributes as I propose the Trim/Extend tool would do. Does it cause problems with default/unique values?

Could the tool operate as it does currently, but add a split operation if a right click was use instead of the left click on the line to extend?

huber-j commented 1 year ago

I think that actually splitting the reference line can lead to unexpected results and is not desirable. For example, a one-to-one-relationship might be expected elsewhere in the project (e.g. one line feature per streetname). However, it would be very useful if there was an option to insert a vertex at the touching point in the reference line as well, thus preserving topology (if the reference line is in the same layer as the line to be extended). Currently (I use QGIS 3.26.3) no vertex is added.

dgreenewalt commented 1 year ago

If the user wanted an unsplit reference line, they could simply merge the 2 lines back together again. This seems like an undesirable extra step. But for those users who want a split reference line (some road data sets and most all property line data sets for example), an equally undesirable extra step is required to split the reference line.

If the "enable topological editing" button is enabled, a new vertex will be added to the refence line if it is editable. I did not realize lines could be extended to different layers. That's a neat feature.

I think "snap to segment" option should be be activated automatically when trim/extend is selected (then turned off again if it was previously off), because it is required for the tool to work.

The trim extend tool is very useful. It would be even more so if the user had the option to control if the reference line was to be split or not. Not all users want the reference line split, but not all users want the reference line whole. A right/left click option could solve this problem.

dgreenewalt commented 1 year ago

A Right Click is already used by the Trim/Extend tool to un-select the reference line. I propose that a feature be added to the Trim/Extend tool allowing a Shift Click to trim or extend the line AND split the reference line at the new intersection point.