-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add support for complex intersection and via way restrictions #4768
Conversation
I would like to try this to give you feedback. Is it possible to try this at http://preview.ideditor.com/newturnrestrictions/ ? |
@manfredbrandl - I put a copy of this branch here for testing: |
@bhousel thanks, i tried and had no problems with useability at all. |
I tried somewhere else and found a bug. i cannot select the "Maria-Theresia-Allee" (grey street connecting from south-west) in the turn restrictions editor: |
Thanks @manfredbrandl that does look like a bug! |
This is the part of the algorithm where trivial sections get trimmed from the vgraph. Removing a vertex from `vertexIds` means "stop checking this one". But there were some situations where it could get removed twice, so we now just verify that `vertexId` is actually in the array before calling `splice`.
By the way @manfredbrandl thanks for posting this intersection.. I made some tweaks to extend the leaf nodes out far beyond the viewport edge, and to better calculate a zoom and center that includes all of the important parts of the intersection.. |
@bhousel it was a pleasure for me to help you. Could you provide the new code on the branch so that i can test it again? |
Just updated http://sonny.7thposition.com/osm/iD/ to ea4ac80 |
- includes in the message the names of the streets - also highlights related segments and nodes along the path The messages are currently a bit rough: U-Turns FROM Black Horse Pike IS allowed... VIA Main Street TO Black Horse Pike
Here are some ideas:
|
I would prefer to see all turn restriction with the selected from way without having to unhide several next levels when there are several via ways. At https://wiki.openstreetmap.org/wiki/Relation:restriction there is an example with three via ways: |
I have found another bug. A very short (e.g. 5 m) deadend way is stretched to the frame in the restriction editor. This looks quite strange.
Especially for large junctions, which are the typical ones requiring complex turn restrictions, 20m seem to be insufficient. Here are some ideas to address this:
Via nodes and ways aren't redundant, and they can't be added automatically in the general case. |
My first thought was to show all existing restrictions by default, but I realized that there could be conflicts due to multiple possible via paths.
I think the example can be reduced to using one via way only, but in general we need more than twovia members. |
Thats a point. Maybe we can have a conflict-checker and initially support editing junctions without conflicts only. iD is easy to use and intentionally simple. It lets you do the most basic tasks while not breaking other people's data. We can support junctions with conflicts later. |
(Trying to reply quickly to most of the feedback - sorry if I miss some) from @slhh:
will consider, but it seems like clutter.
👍 I've added this now, it highlights all ways along the path in the "related" way style. I might adjust it, since this is not very visible
I've added a slider that will let users expand the search (see below)
Agree, but this is #3136 and I don't have time to do it now.
Probably wont at this time - for some very complex intersections (like an SPUI) it can be several dozen. But if we do #3136, this would be replaced by a summary view that might list them.
Yeah this is intentional - I do need to show the user something here and it needs to be long enough to be clickable even with an arrow stuck on top of it, but I think I don't need to extend it quite so far. I'll try a shorter amount. (can you link to the intersection?)
Yes, I noticed this too (testing with the intersection at
Yep, it does this now (the viewer adjusts the zoom to better fit all the key vertices).
Part of the main design goals for this editor is to continue to allow mappers to create restrictions with one click. Our data team at Mapbox does a lot of TR mapping and this is one of their important workflows. But I'll think about whether we can use clicks on different parts of the arrows to do different things.
Yeah intersections with cycles in them and multiple via-ways is a big issue. I think you'll like the slider I made. It's still rough but I like the idea of giving users control of how much detail they want to see (and defaulting them to "not much") BTW - I'm using this intersection as my "worst case scenerio" BTW2 - I also added the ability to tag "only" restrictions, which makes the above intersection much easier to reason about.
Yes I would also model that u-turn as a single via way. The code could handle any number, but I really don't want to go above 2 because it would encourage people to build unnecessarily complicated things. |
(I decided that the larger context of the intersection is important and shouldn't be hidden from the user) Also - show detail slider only if the intersection is complex - hide the restriction editor completely if there is no real intersection (e.g. junction of `highway=path`)
I was definitely missing this, but highlighting all ways along the path seems to make it dispensable now. Maybe, we will need the arrows to control or indicate something later.
It doesn´t expand selectively, and therefore, it doesn't help to control the via path.
#3136 doesn't seem to address the logical misfit.
Agree, it doesn't make sense at the current position of the restriction editor. Make the relation accessible:
Get an overview of existing relations:
I don't think the extension is really required. There can also be non dead ended short ways in the junction.
No, it wasn't a real one. I drew a short dead ended way to the inside of the junction for testing.
The frequent simple restrictions would still one click only, but the rare complex ones would require more clicks. This doesn't seem to degrade efficiency significantly. My approach of unhiding selectively level by level along a path can also be combined with your slider:
Hiding existing restrictions totally doesn't seem to be good. We need to indicate that there is something hidden. This can either be a warning icon at the slider, or more a more specific indicator at the arrow part of the restriction icons of the last displayed level. |
This was used to decide whether to show the "Max Via" control. (It's not really needed for a simple intersection) However since we added the "Max Distance" control, it just makes sense to show both sliders, since the distance can affect the complexity.
(using ',' with css selectors was problematic)
- absolutely positioned attach to inspector, - float slightly above field - looks much better
5baaf99
to
e975014
Compare
But we keep them around in `_oldTurns` and will put them back if the user clicks again to unrestrict the ONLY.
These should not be a thing, and if they are, I'm ok with them being treated as 2 separate ways. We can add code back in later if it turns out to be a widespread issue in OSM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments regarding localizability. Nothing that needs to block this PR, I suppose, but certainly this PR provides more motivation for me to help improve iD’s localization support. 🙂
data/core.yaml
Outdated
via: Via | ||
via_node_only: "Node only" | ||
via_up_to_one: "Up to 1 way" | ||
via_up_to_multiple: "Up to {num} ways" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is another place where non-anglocentric plural support would be desirable: #597.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, makes sense.. The slider only goes up to 2 via ways, and I'm not even sure whether it's worth making it any more extensible than that, so I'm just going to hardcode the string as "Up to 2 ways" to make things easy on the translators.
data/core.yaml
Outdated
straight_on: Straight On | ||
no_turn_string: "{no} {turn} {indirect}" | ||
only_turn_string: "{only} {turn} {indirect}" | ||
allowed_turn_string: "{turn} {allowed} {indirect}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In some languages, it may be difficult to translate these turn
strings independently of the overall sentence. A more sound approach would be to multiply out these strings by all the possible combinations, e.g., “ONLY Left Turn”. In the meantime, languages that have problems with these strings may be able to use the imperative form, e.g., “ONLY Turn Left”.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point.. I'll just enumerate all of these (and leave the {indirect}
as a token replacement)
via: VIA | ||
to: TO | ||
from_name: "{from} {fromName}" | ||
from_name_to_name: "{from} {fromName} {to} {toName}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Languages with declension rules won’t be able to translate this well, but I guess the fact that the prepositions are bold makes it feel more like a form and less like a coherent sentence anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this is extra tricky because the {fromName}
and {toName}
might not actually be proper named roads, but rather strings like "Residential Road" or "Service Road" which could follow different rules depending on the modifier. We don't support different conjugation of the preset name strings, so I'll punt on this one for now. (But yeah, hoping the way we present it in the UI makes it seem more like a filled in form than a grammatically incorrect sentence).
- actionRestrictTurn will no longer "infer" the turn type - restrictionType *must* be passed in - this is ok because the only code we use this action (restrictions.js) already has inferred the type - this simplifies what the action actually does - moved the tests from restrict_turn.js that were really just testing the restriction type inferrence over to intersection.js (and added a few more tests for iD.osmInferRestriction)
- change the "Up to {num} ways" to "Up to 2 ways" (we don't plan to go above 2 for now) - enumerate all the turn types No/Only/Allowed x Left/Right/Straight/U - Add a line for "Click for" to let user know they can click to toggle see #4768 (review)
Thanks everyone who tested this out and provided feedback! The turn restriction editor has learned a few new tricks:
|
This PR adds support for creating turn restrictions in more complex intersections.
Before
After
This is work that I did a few months ago, and has been used internally at Mapbox by our data team. I'm confident that it is stable enough to merge into the main iD that everyone uses. 🎉
Would love to hear people's feedback on ways to make this more useful or easier to understand for casual mappers.
(The text that flashes while I'm using the editor is for debugging - I'll make this friendlier!)
↩️ ⬆️ ⬇️ 🔀