[Script] WME Advanced Closures

Original Script Thread

The original author, dummyd2, of this script stepped away from Waze and left the future maintenance to the WazeDev group. The below description is copied from the original script thread.

Install the WazeDev maintained version from the new Greasyfork: https://greasyfork.org/en/scripts/370072-wme-advanced-closures

The script adds a tab (slashed road) in the left panel, and a highlight on the map.

In the panel:
a button “add advanced closure”
a button “parse CSV” with a log console.

In the closure panel of a segments selection: a button “add advanced closure”.

  • Add advanced closure
    opens a window to generate recurrent closures.
    The window is draggable through its title. To reset the position, click again the button.
  • Range (start date and end date) is the time range on which all closures will apply. In other words, the script will not generate closures before and after this range.
  • Start and duration:
    start is the start time of the closure un a day
    duration is the duration of the closure
  • Description: free text
  • Direction: on a multiple selection, it is the same direction as shown on the map.
  • Ignore traffic
  • (new in V1.1) MTE: MTE list of MTE loaded in WME and whose dates overlaps the defined range
  • Then, choose a tab:
  • Repeat:
  • Times: the closure count
  • Every: duration between the start date/time of a closure and the start date/time of the text closure
  • Each:
    day of the week of the start date/time (if the duration exceeds midnight, the end date/time will be the next day (or some days after), the closure will be applied even if the day of the closure end is not checked)
  • (new in V1.1) Holidays: holidays list based on holidayapi.com. You must select at least 1 segment before to detect the country, and then, click on “Refresh holidays”. If your country is not supported, you can contribute to holidayapi.com. The country abbreviation in WME is not the same as holidayapi.com. So we may need to translate it in the code to get it work. Let us know!
  • The save tab allows you to save all presets but the range and MTE, and to load them.
    New in V1.1: closure details loaded from an existing closure: select 1 segment. If more than 1 segment is selected, closures a read from the first segment only.
  • Once all set correctly, the preview area will show all closures ready to apply. It shows error messages and an orange warning if a closure overlaps on an existing closure, and if a closure is not included in dates of the selected MTE (tooltiptext for details).
  • Select segments
  • Then, apply. The preview will print OK or error messages. Before clicking on apply, choose the right tab (Repeat or Each). After the process, the script will select all segments and open the closure tab in the left panel.
    Cases studies:
    Every day from 12:00 to 14:00 between 13/06 and le 26/06 included
    range: 2016-06-13 -> 2016-06-26
    start: 12:00
    duration: 2:00
    Repeat: 500 times (the script will not create closure after the range end)
    Every: 24:00
    From monday to friday, from 20:00 to 06:00 the next day, from June to December:
    range: 2016-06-01 2016-12-31
    start: 20:00
    duration: 10:00
    Each: mon, tue, wed, thu, fri
  • CSV

apply closures defined in a CSV file.
New in V1.1: added a column (requiered) MTE ID before ‘comment’. Keep empty if no MTE.
Format:

header,reason,start date (yyyy-mm-dd hh:mm),end date (yyyy-mm-dd hh:mm),direction (A to B|B to A|TWO WAY),ignore trafic (Yes|No),segment IDs (id1;id2;...),lon/lat (like in a permalink: lon=xxx&lat=yyy),zoom (2 to 10),MTE ID,comment (optional)
add,"Closure test, by dummyd2","2016-05-27 00:00","2016-05-28 00:00","A to B",Yes,"297004533;297004532","lon=25.53629&lat=-76.47602",6,
add,"Closure test 2, by dummyd2","2016-05-29 00:00","2016-05-30 00:00","B to A",No,"297004533;297004532","lon=25.53629&lat=-76.47602",6,,It's cold here...
  • If the fisrt column starts with ‘add’ or ‘remove’, it is processed by the script. (new in V1.1: remove is now supported)

  • Any other keyword is ignored, including ‘header’.

  • The, the format is described in the header.

  • You must ensure that the map zoom is wide enough to “see” all segments. So, the same CSV can work fine on a screen with a big resolution and doesn’t work on another computer with a lower resolution.

  • Open CSV file

  • The closure list will display under the button

  • You can test segments: check all closures and click on “check segments”. The script will simulate a map move on the lon/lat positions and zoom provided in the CSV, check if segments exists, if you have permissions to make closures on it, and warn you if your closure will overlap an existing closure.

  • On each closure:

  • target will move the map and select segments (will not apply the closure)

  • the arrow -> will move the map and apply the closure (will not select segments)

  • Click ‘Apply’ to apply all checked closures
    If texts are cut, see the tooltiptext
    A mini-log under each closure displays informations about the closure itself. The log under the list is global to all closures.

BE CAREFUL: closures are applied on segments ONE BY ONE. This means the direction A->B (or B->A) is not always the one shown on WME when selecting multiple segments!
So if you have more than one segment to close in one way, you may need to setup 2 closures: one with segments A->B, and another with segments B->A.

  • Highlight
    Closures made by this script are identified by a non-breaking space added at the end of description. If so, the script adds a “road” icon on the map. This non-breaking space is invisible on the app.
3 Likes

Are you going to scan back through old posting on the previous thread for feature ideas/requests or should we go ahead and post them here to review at your leisure?

i like it already. This morning I found a month’s worth of construction closures set for a few hours each day. really glad I have this script.

I can’t speak for the rest of the group, but no I am not.

Right now the focus is just making this one work. Please post feature requests in this thread but understand they will likely not get top priority as there are only a few of us and we all already have a to-do list that we are working through for other scripts/projects - but we certainly don’t want the ideas to be lost!

Thank you for continuing to support this excellent script.

I totally understand and as I (and many others) have stated (not often enough), we greatly appreciate all that the script writers do for us.

My suggestion:
Would it be possible to adjust the days on the Each Tab so that the box is smaller (or add a drag bar to it) There are times that I have a hard time seeing the apply button.

Ideally someone would capture these as “issues” in GitHub so there’s no chance they get buried in the forum, and we can work through them and check them off as we get time.

If you have a GitHub account or don’t mind setting one up (it’s free), you can post issues directly:

https://github.com/WazeDev/WME-Advanced-Closures/issues

Just make sure you search any existing issues to see if someone has already submitted the same thing. Though if you accidentally do that, it’s not a big deal :wink:

Update released - 2018.07.06.01

Fix for links being obscured when WMEFU is enabled.

Fixed Greasyfork and forum links.

Changed the Each tab to show the days of the week as abbreviations and in a single, horizontal line.

Thanks Justin, I didn’t expect it to be so quick. I guess it was a real easy fix. :smiley:

It was a group effort :slight_smile:

I just did a quick scan of the previous thread and only found one other feature request (other than mine) listed. I added that to GitHub issues for this script.

I do not know how the rest of the world works but for France we use Google Sheets to generate a .csv file for our mega traffic event. Often these files are used from one year to the next.

You can see an example on our file on sheet : url=https://docs.google.com/spreadsheets/d/1MGUS1Awqwley-M8y_5v0hEvtqmKZg-wW8UKqJX41pOI Exemple Tour de France[/url]

A new need is born with the availability of .gpx files for the different races during sports events.
It happens more and more often. We would need an extension to Advanced Closures or a new script I don’t really know, able to turn a gps trace into a permalink list (text file) that we could copy in our Google sheets.

This feature would be of great help with the tedious creation of permalink which is not an exciting thing.

That would be a good idea for a separate script, to read a coordinate of some sort (KML, GeoJSON, GPX, WKT, etc.) and generate a list of segments it overlaps; probably wouldn’t be a good fit for this one. WME Geometries might be a good fit

Perfect. Many thanks !

Shmupi

It’s not done yet…

I’m running into an exception that prevents me from creating my closures. I’m doing the following:
Range Start: any date
Range End: any date
Start: 2100
Duration: 8 hrs
Select Each then All

Several closures appear in the preview.
Click on Apply
The exception TypeError: Cannot read property ‘TWO_WAY’ of undefined is thrown from this line:
direction = direction == “1” ? sc.DIRECTION.A_TO_B : direction == “2” ? sc.DIRECTION.B_TO_A : sc.DIRECTION.TWO_WAY;

The debugger shows that sc is an object that does not contain DIRECTION as a member.

Thanks
Kevin

I have not had any issues lately using the script. Could there be another reason? New road, unknown direction on it?

DM me in discord if you want me to give it a shot.

Definitely the script is not working now… either entering an individual closure or parsing a csv, on Chrome it loops and does nothing

Update:
Excecution stops at script line 760:
direction = direction == “1” ? sc.DIRECTION.A_TO_B : direction == “2” ? sc.DIRECTION.B_TO_A : sc.DIRECTION.TWO_WAY;

I just used it on several closures with no issues. Not sure if this makes a difference but I always set the direction as 2-way (even on one-way segments) unless I am closing a single direction of a 2-way segment (which I have not done in a while) I will test that out.

EDIT: My test of a single direction on a 2-way segment worked without problems.

What version are you running?

Ver 1.8.2 on Chrome

Tried with this setting:
2018-07-29_182121.png

and get this on Chrome console:
2018-07-29_182159.png