5

I have tried to find a solution for this everywhere, with no result... My problem is that I want to be able to manually draw a line that automatically snaps to a line (creating an exact copy of the other lines geometry) that's on another layer (using something like this: How to create a line with start and end points which are in another layer in QGIS?).

See example in attached image. This is how it would look if just using the snapping option. I will loose a few percent of length in the new lines compared to the lines in the other layer, and will later have to compensate that loss of length in some calculation (something I'd rather not do).

I need to manually select which lines that should be created, therefore I can't use any automatic method that creates lines for the whole map (if such should exist).

Is there any way to alter the lines afterwards, to match the other layers' lines? Or perhaps a plugin tool that I haven't yet found, that can help me in the manual creation of these lines?

Example of snapping line

4
  • How about select the desired reference polylines and just copy + paste to the "new" layer? Would that work for you? You might have to do some trimming and joining lines after, but sounds faster that digitizing the all lines again. Commented May 14, 2014 at 9:54
  • Or do you mean something like this: plugins.qgis.org/plugins/autoTrace ? Commented May 14, 2014 at 10:24
  • Yes, that is almost exactly what I was looking for @Spießbürger :) (If I could press mouse button only twice per line, that would've been 100% of what I was thinking about). Thanks for the tip!
    – andrelar
    Commented May 14, 2014 at 11:36
  • The plugin is still new and has a couple of known issues: github.com/lutraconsulting/qgis-autotrace-plugin/… - But it is easy enough to work around the little bugs. Commented May 14, 2014 at 12:38

2 Answers 2

5

Tracing is now implemented in Advanced Digitizing Toolbar advanced digitizing toolbar

The layer(s), you want to snap to, has(ve) to be visible and snapping option has to be turned on. If you want to snap to a certain layer, use Advanced Layer Selection in Snapping Options Menu.

enter image description here

Tracing aplies via standart 'Add Feature' button:

tracing

4

For those people that are too lazy to click every vertex while tracing an already existing vector layer [[irony]], the plugin Autotrace (http://plugins.qgis.org/plugins/autoTrace/) is a real blessing. It is especially useful when simple operations (cut, copy, paste) or geometric operations (overlap, intersect, etc...) don't get the right result. I use it often to retrace geologic-related polygons to add different fault lines to them.

Usage:

  • Install plugin
  • Turn on snapping for the layer that you want to trace (10 to 20 px relative to screen is ideal)
  • Turn on editing in the layer where the new feature will be created
  • If new and traced feature are in two layers turn editing on in both layers (easier to see the vertices)
  • Start your feature in whitespace or along the polygon you want to trace. Ideal is 1 to 3 manual clicks on vertices.
  • Then press shift and move the mouse over the vertice that you want to trace to.
  • If AutoTrace can find a way to that vertice you will see that the edit-polygon will run along the feature being traced.
  • Leftclick to trace to that point.
  • If trace takes the wrong direction, hold "Ctrl"+"Shift" for the reverse path.

There are some known issues at the moment:

  • You can only trace along one feature. Solution is to trace one feature, then again do 1 to 3 clicks on new feature, then trace should work again.
  • First and last point of a feature can't be traced to. Solution is to manual snap to the first few and last few points of a feature. In between you can trace very long distances.
  • Tracing a closed-line will not jump across the the start/end-point. Solution is to do some manual clicks across those two equi-positioned points.
  • Tracing only works vertice to vertice and not segment to segment. Solution is some manual snapping when you need that.
  • Attribute form is not shown after finishing drawing. Solution is pressing "save layer edits" often. Keep the attribute table open and fill in the information while you edit. Putting it off till later will cost you time because you have to click on the features to see if you have the right one.

Bug reports:

Homepage:

5
  • When I got the idea of the workarounds for the bugs, it work pretty good. And yes, I am that lazy! :) (Especially when I will need to do it on 1000++ line segments...).
    – andrelar
    Commented May 14, 2014 at 13:02
  • I think we can safely assume that every person is too lazy to click every vertice of a polygon :) Commented May 14, 2014 at 13:06
  • 1
    Aah, irony :) For a moment, I almost believed there were people who liked that sort of tedious task... Perhaps in some kind of therapeutic way :D
    – andrelar
    Commented May 14, 2014 at 14:08
  • I'm not absolutely sure, but I think that it was necessary to re-start QGIS after installation (QGIS 2.6, Autotrace 1.0.4) to get it to appear in menus. Note also that the autotrace button (not unreasonably) is greyed out and therefore difficult to find until a layer is in edit mode - it's on the digitising toolbar (i.e. alongside add feature, node tools, and similar). Commented Mar 4, 2015 at 17:24
  • A couple of notes on usability now I've got used to this plugin... things I struggled with (QGIS 2.6)... The autotrace button is unobvious until the layer is put into edit mode (no other main sign that the plugin is installed). Click the autotrace button INSTEAD of (not as well as) the add feature button. Won't autotrace for me to the end vertex where lines join (choose preceding vertex). Right click to end drawing. After ending (since the attribute form not shown) click the info button and the new line immediately to access this form. Commented Mar 11, 2015 at 10:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.