Discussion for the unofficial, community-developed addons, extensions and scripts built for the Waze Map Editor.

The official index of these tools is the Community Plugins, Extensions and Tools wiki page.

Post Reply
Forum rules
Discussion for the unofficial, community-developed addons, extensions and scripts built for the Waze Map Editor.

DO NOT START a new thread unless it is about a new idea. Keep discussion of existing tools within the main thread for that tool.

The official index of these tools is the Community Plugins, Extensions and Tools wiki page.

[Script] WME Straighten Up!

Post by dBsooner
WME Straighten Up! (WME SU!)

Version: 2024.01.31.01

Greasyfork: https://greasyfork.org/en/scripts/38834 ... aighten-up

Description: Straighten selected WME segment(s) by aligning along straight line between two end points and removing geometry nodes.

Developer(s): dBsooner through WazeDev. WazeDev owns the script and all information attached to it.

Special note: Due to the nature of this script, it will not work for editors rank 1 or 2.

Feature list:
  • Straighten selected segments so they are all in a perfectly straight line between the two endpoint junction nodes. This is done by moving the JNs between the endpoints to the nearest point on the vector line between the two endpoints.
  • All segments must be at least partially in the current view of the map.
  • Recommended to only select continuous segments and segments share at least one name in common.
  • Shortcut to run script available under editing shortcuts in WME.
  • Translatable into any supported WME language. (Calling anyone that wants to assist in translating... PM me.)
  • Safety checks for:
    • Segments with conflicting names.
    • Long junction node moves (when a JN would move a distance greater than 10m).
    • Micro doglegs (mDL) checks:
      • 1 segment selected: Will check for existence of a geometry node within 2 meters, on the selected segment only, of either junction node.
      • More than 1 segment selected: Will check for existence of a geometry node within 2 meters of all junction nodes on all segments connected to the junction node, regardless if the segments are in the selection or not. The reason is if the junction node is moved, it could affect the angle of a mDL on any segment, not just the segments selected.
    • Non-continuous selected segments (when selected segments don't form a continuous selection).
    • Sanity check (when you select more than 10 segments at once).
    Note: These safety checks can be controlled via settings to: Give a warning, give an error or give no warning or error.
Instructions:
  1. Select the starting segment.
  2. ALT+click the ending segment.
    Note: If the segments you wanted to straighten are not all selected, unselect the segmens and start over using CTRL+click to select each segment instead.
  3. Click "Straighten up!" button in the sidebar.
Changelog:

Code: Select all

2024.01.31.01: BUGFIX: Check for micro dog leg (mDL)
2024.01.22.01: CHANGE: Compatibility with recent WME releases. (Thank you jangliss)
2023.08.02.01: CHANGE: WME release v2.180-7-geb388e8d3 compatibility.
2023.05.10.01: CHANGE: Reverted to 100% vanilla JavaScript, removing reliance on jQuery.
               CHANGE: Moved button and removed extra code no longer needed.
               CHANGE: Switch to WazeWrap for script update checking.
2023.04.19.01: CHANGE: WME production now includes function from WME beta.
2023.04.03.01: NEW: Check for updated version on load.
               CHANGE: Future (possible) WME changes preparation.
2023.03.15.01: CHANGE: New bootstrap routine.
               CHANGE: Updated code to use optional chaining.
               CHANGE: Code structure with new linter options.
               CHANGE: Code cleanup.
               CHANGE: Utilize @match instead of @include in userscript headers.
               CHANGE: WazeWrap compatibility.
2022.08.26.01: BUGFIX: Minor bugfixes.
2022.07.05.01: CHANGE: Compatibility with latest WME update.
2020.07.27.01: NEW: Shortcut to run Straighten Up!
               CHANGE: WME map object references.
2020.06.16.01: CHANGE: Keep button displayed during segment editing.
2019.12.06.02: CHANGE: Move button closer to top of side panel.
2019.12.06.01: CHANGE: WME v2.43-40-gf367bffa4 compatibility.
2019.10.18.01: NEW: Add button if loading segment selection via permalink.
2019.08.26.01: CHANGE: Added ru translation.
               CHANGE: Detect if selected segments are already straight.
2019.08.16.01: CHANGE: Enhance check for micro doglegs (mDL).
2019.08.15.01: NEW: Initial release.
History: I have worked with an author of a script that wasn't well known that would straighten segments by move nodes to a straight line along a vector between two other points. I took their original code and modified it to be quicker, more reliable and provide some additional features and safety measures.

Special thanks: jonny3D (and impulse200) for allowing me to fork his / their work to create this.

Screenshots:
https://i.ibb.co/1LTWC7S/Crooked-St1.png https://i.ibb.co/F0M3Nmk/Crooked-St2.png
https://i.ibb.co/7tg714D/SU-1.png https://i.ibb.co/pjgRBHX/SU-2.png
 
 
 
 
 
 
 
 
 
 
 
 
dBsooner
Map Editor - Level 5
Map Editor - Level 5
Posts: 767
Has thanked: 367 times
Been thanked: 631 times

POSTER_ID:16834605

1

Send a message
Last edited by dBsooner on Wed Jan 31, 2024 4:50 pm, edited 18 times in total.
https://s.waze.tools/scrp.pnghttps://s.waze.tools/am.pnghttps://s.waze.tools/betc.pnghttps://s.waze.tools/beta.pnghttps://s.waze.tools/mapr.pnghttps://storage.googleapis.com/wazeopedia-files/7/74/Waze_signature_200k_plain.pnghttps://s.waze.tools/c5s.png
• AM: Eastern Oklahoma, DFW, Southern Florida
• Wiki: WME | Editing Manual | Best Practices | FAQ | Places
• T-Mobile | iPhone 14 Pro | iOS Latest | Waze Latest Beta


Post by andrcondon
Installing and checking out. It's already my favorite script!
andrcondon
Map Editor - Level 6
Map Editor - Level 6
Posts: 250
Has thanked: 60 times
Been thanked: 66 times
Send a message

Post by andrcondon
I have a suggestion, that I don't know if can be done.
I'd like to have the option of instead of moving a node to the nearest vector, to move it to the straight point of the intersecting road.
Maybe it can be an option, perhaps when you select four segments converging to a node.

Let me know if you think this is feasible

Thank you
andrcondon
Map Editor - Level 6
Map Editor - Level 6
Posts: 250
Has thanked: 60 times
Been thanked: 66 times
Send a message

Post by DaJoNel
Is there any chance another script writer will fork this project and release a version that works?
DaJoNel
State Manager
State Manager
Posts: 38
Has thanked: 2 times
Been thanked: 2 times
Send a message

Post by dBsooner
I forgot to add that it also checks for micro dog legs (mDLs). If a geometry node exists within 2m of a JN, it gives you a warning. I need to add that as a setting override as well.
dBsooner
Map Editor - Level 5
Map Editor - Level 5
Posts: 767
Has thanked: 367 times
Been thanked: 631 times
Send a message
https://s.waze.tools/scrp.pnghttps://s.waze.tools/am.pnghttps://s.waze.tools/betc.pnghttps://s.waze.tools/beta.pnghttps://s.waze.tools/mapr.pnghttps://storage.googleapis.com/wazeopedia-files/7/74/Waze_signature_200k_plain.pnghttps://s.waze.tools/c5s.png
• AM: Eastern Oklahoma, DFW, Southern Florida
• Wiki: WME | Editing Manual | Best Practices | FAQ | Places
• T-Mobile | iPhone 14 Pro | iOS Latest | Waze Latest Beta

Post by dBsooner
jonny3D wrote:Great work! Can you add the ability to select two unrelated segments and straight align all segments including all others between the selected ones without the need to select them all? So it would be easier to select only the initial and final segments of the street line.
I could try. The problem will be we would have to rely on the routing server to determine what the "straight line" is between the two selected segments. Sometimes that ends up being not what we would expect to be. I'll give it some thought and see what I can come up with.
dBsooner
Map Editor - Level 5
Map Editor - Level 5
Posts: 767
Has thanked: 367 times
Been thanked: 631 times
Send a message
https://s.waze.tools/scrp.pnghttps://s.waze.tools/am.pnghttps://s.waze.tools/betc.pnghttps://s.waze.tools/beta.pnghttps://s.waze.tools/mapr.pnghttps://storage.googleapis.com/wazeopedia-files/7/74/Waze_signature_200k_plain.pnghttps://s.waze.tools/c5s.png
• AM: Eastern Oklahoma, DFW, Southern Florida
• Wiki: WME | Editing Manual | Best Practices | FAQ | Places
• T-Mobile | iPhone 14 Pro | iOS Latest | Waze Latest Beta

Post by dBsooner
jonny3D wrote:
dBsooner wrote:I could try. The problem will be we would have to rely on the routing server to determine what the "straight line" is between the two selected segments.
I apologize. What I wanted is already there – you need to select the initial segment and with Alt-button select the final one to select the part of the street between two points.
Yep, that's the easiest way to do it. It is in the "help" documentation in the SU! sidepanel button. It's also in the text I sent to you to have translated to Russian.

Thank you again for everything!!
dBsooner
Map Editor - Level 5
Map Editor - Level 5
Posts: 767
Has thanked: 367 times
Been thanked: 631 times
Send a message
https://s.waze.tools/scrp.pnghttps://s.waze.tools/am.pnghttps://s.waze.tools/betc.pnghttps://s.waze.tools/beta.pnghttps://s.waze.tools/mapr.pnghttps://storage.googleapis.com/wazeopedia-files/7/74/Waze_signature_200k_plain.pnghttps://s.waze.tools/c5s.png
• AM: Eastern Oklahoma, DFW, Southern Florida
• Wiki: WME | Editing Manual | Best Practices | FAQ | Places
• T-Mobile | iPhone 14 Pro | iOS Latest | Waze Latest Beta

Post by dBsooner
2019.08.16.01 has been released!!

Code: Select all

2019.08.16.01: CHANGE: Enhance check for micro doglegs (mDL).
Instead of just checking for geometry nodes within 2 meters of the junction nodes along the selected segments, I changed to checking for them along ALL segments connected to the junction nodes.

Micro doglegs (mDL) checks:
  • 1 segment selected: Will check for existence of a geometry node within 2 meters, on the selected segment only, of either junction node.
  • More than 1 segment selected: Will check for existence of a geometry node within 2 meters of all junction nodes on all segments connected to the junction node, regardless if the segments are in the selection or not. The reason is if the junction node is moved, it could affect the angle of a mDL on any segment, not just the segments selected.
dBsooner
Map Editor - Level 5
Map Editor - Level 5
Posts: 767
Has thanked: 367 times
Been thanked: 631 times
Send a message
https://s.waze.tools/scrp.pnghttps://s.waze.tools/am.pnghttps://s.waze.tools/betc.pnghttps://s.waze.tools/beta.pnghttps://s.waze.tools/mapr.pnghttps://storage.googleapis.com/wazeopedia-files/7/74/Waze_signature_200k_plain.pnghttps://s.waze.tools/c5s.png
• AM: Eastern Oklahoma, DFW, Southern Florida
• Wiki: WME | Editing Manual | Best Practices | FAQ | Places
• T-Mobile | iPhone 14 Pro | iOS Latest | Waze Latest Beta

Post by dBsooner
2019.08.26.01 is out!!

Changelog:

Code: Select all

2019.08.26.01: CHANGE: Added ru translation.
               CHANGE: Detect if selected segments are already straight.
 
dBsooner
Map Editor - Level 5
Map Editor - Level 5
Posts: 767
Has thanked: 367 times
Been thanked: 631 times
Send a message
Last edited by dBsooner on Tue Jul 05, 2022 10:17 pm, edited 2 times in total.
https://s.waze.tools/scrp.pnghttps://s.waze.tools/am.pnghttps://s.waze.tools/betc.pnghttps://s.waze.tools/beta.pnghttps://s.waze.tools/mapr.pnghttps://storage.googleapis.com/wazeopedia-files/7/74/Waze_signature_200k_plain.pnghttps://s.waze.tools/c5s.png
• AM: Eastern Oklahoma, DFW, Southern Florida
• Wiki: WME | Editing Manual | Best Practices | FAQ | Places
• T-Mobile | iPhone 14 Pro | iOS Latest | Waze Latest Beta