Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Follow a path #1614

Closed
oskarlin opened this issue Jun 23, 2013 · 25 comments · Fixed by #8671 · May be fixed by #7649
Closed

Follow a path #1614

oskarlin opened this issue Jun 23, 2013 · 25 comments · Fixed by #8671 · May be fixed by #7649
Labels
operation An editing operation / edit menu item

Comments

@oskarlin
Copy link

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!

@tmcw
Copy link
Contributor

tmcw commented Jun 23, 2013

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?

@oskarlin
Copy link
Author

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!

@oskarlin
Copy link
Author

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

@bhousel
Copy link
Member

bhousel commented Mar 12, 2016

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

@int-ua
Copy link

int-ua commented Mar 12, 2016

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.

@Thue
Copy link
Contributor

Thue commented Oct 29, 2016

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."

@1ec5
Copy link
Collaborator

1ec5 commented Nov 27, 2016

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

@bhousel bhousel added the operation An editing operation / edit menu item label Dec 18, 2016
@grischard
Copy link
Contributor

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.

@IcyMidnight
Copy link

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->....

@slhh
Copy link
Contributor

slhh commented Mar 13, 2018

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

@BjornRasmussen
Copy link
Contributor

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.

@famo
Copy link

famo commented Jun 7, 2019

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! 😃

@teschlg
Copy link

teschlg commented Sep 12, 2019

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).

@kaligrafy
Copy link

kaligrafy commented May 28, 2020

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.

@quincylvania
Copy link
Collaborator

@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.

@kaligrafy
Copy link

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.

@quincylvania
Copy link
Collaborator

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

@kaligrafy
Copy link

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!

@kaligrafy
Copy link

kaligrafy commented Jun 2, 2020

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.

@quincylvania
Copy link
Collaborator

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.

@kaligrafy
Copy link

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.

@pardthemonster
Copy link

@kaligrafy: Any plans to resolve conflict PR #7649 or rather re-implement this greatly needed feature on the latest iD?

@kaligrafy
Copy link

Well, unfrotunalty, I don't have the time right now to do that, but fell free to try to fix it if you think it could be usefull on the short term. Thanks!

@kaligrafy
Copy link

I would keep this issue open, since my method is very different from the merged one. I still think we should add mine too. I use it everyday on my fork.

@kaligrafy
Copy link

My follow operation can use a beginning and an end points and follow in between, which is way faster on complex polygons. However, the merged version is really useful for short segments though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
operation An editing operation / edit menu item
Projects
None yet
Development

Successfully merging a pull request may close this issue.