Id: Follow a path

Created on 23 Jun 2013  路  21Comments  路  Source: openstreetmap/iD

In other mapping software like ArcGIS and OCAD there is an option for following a polyline/polygon when creating a new object instead of adding all nodes one by one.

This function would be amazing and time saving if iD had it!

operation

Most helpful comment

Here is a patch and two gist: one for the action and one for the operation.
This patch and code is for the v3_prototype branch.

You must first select the target way (the one that will follow the source way), then the source way, then the starting point, then the ending point. There must not be any other point between the start point and end point on the target way, and both points must be connected to both the source and target ways. I did not create an icon in the toolbar nor any test or specs yet, but it is functional until someone finds the time to complete the code.

All 21 comments

Not super clear what this means: you mean following an existing shape? From a vector, or raster source? What's the user experience/input that goes into this?

Yes, sorry about my vague description. I mean exactly what you said, following an existing shape. Lets say you have an island (already created coastline) where parts of it is covered by a forest. When mapping the forest you want to follow the coastline for a while and if the coastline is very complex it takes ages now when you have to click on every node.

What I'd like it to be: You create your shape by clicking the nodes like now, and when you get to an already existing polygon/line you hold down some key and click on that path, then instead of clicking on each node, you just follow the path with the mouse (without clicking) until you have followed what's needed and then you release the key and continue putting out other nodes outside the existing shape. Voila!

Here's an example of tracing in ArcGIS:
http://www.youtube.com/watch?v=XB-9qaHkx8Y

And here's an example in OCAD:
http://ocad.com/howtos/34.htm

I'm reading this issue as being like the Follow Line feature in JOSM/Potlatch2.

Looks like it should be enough to just select first and last node you want from a path segment, isn't it? Maybe three nodes if it's a closed shape to determine direction.

bhousel made a good point in IRC, which deserves consideration, so I want to preserve for posterity: "it could just be a key that connects the next point, and you can repeatedly press it to connect more points."

The logic in #3539 for staying on the same line will come in handy here.

https://josm.openstreetmap.de/wiki/Help/Action/FollowLine has an example of how this works in JOSM.

The DWG has recently been in discussions with an user who was mapping everything as multipolygons, because splitting a way into segments and building an MP in iD is easier than manually following big parts of another line. Having this feature would directly help this user's mapping.

I've come across some mapping tasks for this as well. It would be nice to click a node (A) on a complicated poly, click the next node (B) and tap some key (f for "follow"?) and have new nodes added to follow in the direction A->B->....

We should also support to follow a path with constant distance. Otherwise, we would encourage users to glue landuses to highways.

I have an idea for how this could be integrated well into the current UI:

Start drawing a line like this, and then shift-click on the the point farther along the way you want to follow:
image

The result would look like this:
image

The behavior would also work when drawing areas.

This is different from JOSM where you just click F to continue drawing along the current way, but it seems like a better solution for iD since users would not have to hold down F for a certain amount of time.

I have an idea for how this could be integrated well into the current UI:

Start drawing a line like this, and then shift-click on the the point farther along the way you want to follow:

Looks like a very sane and time efficient method to me. I would really like to see this implemented in iD! 馃槂

This seems straightforward to implement: If a hotkey is pressed (while creating a line/area) and the current point is a boundary point of an existing line or the current and the previous point are on an existing line, follow this line by adding the next point (if there is more than one line do nothing).

Here is a patch and two gist: one for the action and one for the operation.
This patch and code is for the v3_prototype branch.

You must first select the target way (the one that will follow the source way), then the source way, then the starting point, then the ending point. There must not be any other point between the start point and end point on the target way, and both points must be connected to both the source and target ways. I did not create an icon in the toolbar nor any test or specs yet, but it is functional until someone finds the time to complete the code.

@kaligrafy Looks cool! Could you create a branch and draft pull request for what you've done so far? It's hard to work with code in gists.

Also, we're not updating the v3-prototype branch so this will need to go into develop, but only a few minor changes are needed for that.

OK, I'll try with the develop branch and add a pull request. I tested it a bit more this morning. It works most of the time, but there can be some issues when following can be done on two sides.

@kaligrafy Let me know if you need any assistance! I can help with the code issues once the PR is up.

I am working on a second action called smooth to add automatic curves to lines. When I'm done with it, I will review the code and provide a pull request for both actions.

The follow action does not work all the time (it fails when there are two sides to choose from or when the first point and last points are the starting and ending nodes of the target line). I will try to fix them.

I have a question: where is the code that loads the icon for the action? Where should I put the svg icon and where can I link it to the action? Thanks!

Now the gist is fixed for any kind of ways for source and target (closed, not closed, clockwise, counterclockwise) and no need to select the two intersecting points if there are only two between the source and target ways. I will post a pull request soon.

Now the gist is fixed for any kind of ways for source and target (closed, not closed, clockwise, counterclockwise) and no need to select the two intersecting points if there are only two between the source and target ways.

Great! Looking forward to the PR.

I am working on a second action called smooth to add automatic curves to lines.

Sounds interesting, but please make a separate PR since it's not related to following a path.

Where should I put the svg icon and where can I link it to the action?

Simply put the file under svg/iD-sprite/operations/ with the operation ID and it will be loaded automatically. Don't worry about the icon too much, we can work on that later.

Manual:

  • First select the target way (the one that willl follow)
  • Then select the source way (the one to follow)
    If only 2 points intersect both the source and target ways, just press the F key.
    If more than 2 points intersect both source and target ways:
  • Add the starting intersection point to the selection
  • Add the ending intersection point to the selection
  • Press the F key.
Was this page helpful?
0 / 5 - 0 ratings

Related issues

bhousel picture bhousel  路  3Comments

1ec5 picture 1ec5  路  3Comments

scaidermern picture scaidermern  路  3Comments

tmcw picture tmcw  路  3Comments

manfredbrandl picture manfredbrandl  路  3Comments