Get a sneak peek at whats next for Permanent Hazards on our April 7th Office Hours!
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 by berestovskyy
So here is a really simple script for a start. It abbreviates Saint to St., Street to St and Avenue to Ave. But only if the street name has more than 15 letters.

Code: Select all

if('<your country>' == segment.country)
{
    if(segment.street.length > 15)
        segment.street = segment.street
            // please reference javascript replace for details
            .replace(/\bSaint\b/, "St.")
            .replace(/\bStreet\b/, "St")
            .replace(/\bAvenue\b/, "Av")
        ;
}
Copy and paste it into WMET then position your view over few streets and use '1 (run once)' button to test it.
berestovskyy
Posts: 912
Has thanked: 321 times
Been thanked: 832 times
Send a message
Last edited by berestovskyy on Sun Sep 15, 2013 3:58 pm, edited 1 time in total.

Post by berestovskyy
Here is another script for tidying up railroads. This script sets lvl -5 trails back to rails and for all the rails sets no city, lvl -5, lock 5, two way properties.

Code: Select all

// please put your country name below
if('<your country>' == segment.country)
{
    if(segment.isTypeOf("rail")
        || (segment.isTypeOf("trail") && segment.level == -5)
        )
    {
        // please change the street name below
        segment.street = 'Railroad';
        segment.city = '';
        segment.type = 'railroad';
        segment.level = -5;
        segment.direction = 'two way';
        segment.lock = 5;
    }
}
Copy and paste it into WMET and set your country and street names (i.e. segment.country = 'France'). Then position your view over the railroad or lvl -5 walking trail and use '1 (run once)' button to test it.
berestovskyy
Posts: 912
Has thanked: 321 times
Been thanked: 832 times
Send a message
Last edited by berestovskyy on Sun Sep 15, 2013 4:01 pm, edited 1 time in total.

Post by berestovskyy
To unlock all segments in an area:

Code: Select all

segment.lock = 1;
To lock the segments according to a lock map use the following script.
Please adjust the lock levels according to your country guidelines.

Code: Select all

if('<your country>' == segment.country)
{
    // 'road type': lock level
    // use zero to leave lock untouched
    var lockMap = {
        'Railroad': 0,
        'Walking Trail': 0,
        'Pedestrian Boardwalk': 1,
        'Stairway': 1,
        'Private Road': 1,
        'Dirt Road': 1,
        'Runway': 1,
        'Parking Lot Road': 1,
        'Service Road': 1,
        'Street': 1,
        'Primary Street': 3,
        'Minor Highway': 3,
        'Ramp': 3,
        'Major Highway': 3,
        'Freeway': 5,
    };
    var newLock = lockMap[segment.type];
    if(newLock) segment.lock = newLock;
}
berestovskyy
Posts: 912
Has thanked: 321 times
Been thanked: 832 times
Send a message
Last edited by berestovskyy on Sun Sep 15, 2013 4:08 pm, edited 1 time in total.

Post by berestovskyy
mrgrumpy wrote:And how do you propose to stop non level 6s getting it?
My proposal is to send the download link to lvl 6s only. At the moment the links are sent to the following editors:
orbitc
argus-cronos
petervdveen
MdSyah

I hope you have no objections regarding those 4. And all of them were asked to do not redistribute the script further.
dmcconachie wrote:Couldn't disapprove of this tool more!
All of my scripts are local, they do not download any code every time you start WME like many other scripts do. So you can review my code before you use it. None of my scripts is logging on a server when you use it.

IMO distributing open source script just among lvl 6 editors is a way more secure in comparison with other scripts here on the forum and there on the wiki.

That is just my opinion.
berestovskyy
Posts: 912
Has thanked: 321 times
Been thanked: 832 times
Send a message

Post by berestovskyy
Thanks you guys for the feedback!

1. My intentions are open and sincere. I'm not looking for ways of gaining points. That is why I shared the idea and the script with you.

2. I contacted to some champs in PM before my first post on the forum and after that. Nobody told me "Don't do this". There were two main concerns and I really tried to meet them: 1) the script was passed to waze champs only and 2) the button '1 (run once)' was implemented.

3. The script is BETA, and I do agree that it's not that user friendly. My plan was to create a set of scripts with your guys help and then in v0.3 I would create a list of those scripts with editor level/country restrictions.

4. The difference between v0.1 and v0.2 is huge - ~200 vs ~1200 lines of code. So you can't just throw those example scripts inside v0.1 - it simply does not have any functionality but panning the map.

5. There are other WME extensions on wiki/forum which allow to select hundreds of segments in one click and then edit them. And they are available for lvl 1 editors and downloadable.

So, I passed the link to 4 champs I mentioned before. I have few more requests from CMs but I put them on hold until we resolve this issue.

I propose you guys appoint some of the champs to distribute the script, I'm totally ok with that. If anyone interested in user friendly v0.3 please let me know.

Thanks!
berestovskyy
Posts: 912
Has thanked: 321 times
Been thanked: 832 times
Send a message

Post by berestovskyy
petervdveen wrote:Nxxx roads should be minor for example.
Of Major roads locked at lv4, freeway at lv5.
Try the following code:

Code: Select all

if('Belgium' == segment.country)
{
    if(segment.isTypeOf('major'))
        segment.lock = 4;
    else if(segment.isTypeOf('freeway'))
        segment.lock = 5;

    if(-1 != segment.street.search(/^N\d+[a-zA-Z]?\b/))
        segment.type = 'minor';
}
It will lock and change the type in one run. If a road name starts with a capital N following by few digits and one optional letter at the end then the road type will be changed to Minor Highway if I get you correctly.

Please double check the changes.
berestovskyy
Posts: 912
Has thanked: 321 times
Been thanked: 832 times
Send a message

Post by berestovskyy
sketch wrote:What it definitely shouldn't be is open source, and definitely not in here. Remove the explanations from this forum and include instructions either only in PM to champs or on the global champs forum.
The descriptions and details are removed, but I don't have an access to the champs forum, sorry.
sketch wrote:And I agree that it seems too easy to mess up. Make a GUI for it and include confirmation prompts that make you type in a three-letter code before doing any big edit.
I planed to create a per country set of scripts with your help and then in v0.3 make a GUI with just a list of those scripts. For instance, the script "segment.lock = 1" would be named as "Unlock all segments" and available for every country. The "Apply the lock map" script would be just for specific countries and for lvl 5 or 6 (per country) editors. Then the "Check street name abbreviations" etc etc.

In v0.3 I planned to make just a list of checkboxes so the editor does not edit the script, but just switch it on or off (see picture below). That was the plan...
berestovskyy
Posts: 912
Has thanked: 321 times
Been thanked: 832 times
Send a message
Attachments

Post by berestovskyy
Here is the list of features to be implemented in v0.3. Please review it and correct me sooner rather than later ;)

Security:
- script will be reviewed by a waze champ prior to next release;
- WMET 0.3 will be compiled and encrypted, so the source code will not be available;
- the download link will be provided on request and only to: Lvl5+? champs only? YOU DEFINE IT

User interface:
- just a predefined list of fixes (see an image in my previous post);
- user will be able just to switch every fix on or off, no options;
- a fix will appear on the list if WME is positioned over a specific country and editor's level is sufficient;

Fixes/features to be available for ALL COUNTRIES:
1. Pause on highlight: WMET will pause if any of the segments is highlighted by the Toolbox or Colour Highlights (idea of paulkok_my)
2. Fix one letter city names: get the name from adjoining segments/top city.
Exceptions: http://en.wikipedia.org/wiki/List_of_short_place_names
3. Insert a space after abbreviations: 'St.X' -> 'St.[space]X' (but not at the end)
4. Unlock all segments (just to remind we're always talking about editable for the editor segments)
5. + call the Toolbox fixes by OyyoDams
6. + functionality of Node Remover by bgodette

Fixes which might be available for SOME COUNTRIES (upon the champs/CMs request):
1. Apply the lock map: lock all freeways to lvl 5, majors to lvl 4 etc.
2. Transliterate cyrillic: add an alt street with transliterated street name, i.e. 'Львів' -> 'Lviv'
3. Abbreviate: if the name is longer than predefined limit -> abbreviate according to the table
4. Correct abbreviations: expand incorrect abbreviations ('Dv' -> 'Divide'), correct the case 'st.' -> 'St.', or correct the abbreviation 'St.' (at the end) -> 'St' (street)
5. Correct road types: if the road name starts with a pattern -> set corresponding road type
For instance: 'A[digits]' -> freeway, 'O[digits]' -> primary street etc.
6. Correct some road names: 'A4 - E40' -> 'A4 / E40'
7. Correct ramp names: '... CityA, CityB' -> '... CityA / CityB'
8. Change walking trails to railroads (taking elevation -5 into account)
9. etc upon request

What do you think?
berestovskyy
Posts: 912
Has thanked: 321 times
Been thanked: 832 times
Send a message

Post by berestovskyy
Hi!
Guys, I need someone of the champs to review if the new version of WMET secure enough, i.e. WMET has a tool locked to a specific country and you have to try to unlock this tool to use over another country.

I have written few PMs but if you have a javascript background and want to check it, please let me know in PM.

Thanks!
berestovskyy
Posts: 912
Has thanked: 321 times
Been thanked: 832 times
Send a message

Post by berestovskyy
WMET 0.3.1.png
(20.55 KiB) Downloaded 1586 times
Hey,
WMET 0.3.1 Release Candidate is available for champ's preview.

What's new?
1. The script is secure, the source code is hidden.
2. User interface now is clean, easy to use and user friendly.

Reports
I decided to divide the tools in two main groups: Reports and Fixes (see below). WMET report is a list of permalinks grouped by city and street name. Report has no functionality to change anything on the map.
Here is an example of a report: forum link.

In report WMET may include the following:
  1. Toolbox: Report highlighted segments
    Minimum Editor Level: 1
    Country restrictions: none

    Create a report of segments, highlighted by WME Toolbox:
    1. In the Toolbox switcher choose a selection of segments to highlight.
    2. Run WMET and get the list of permalinks to those segments.
  2. WCH: Report highlighted segments
    Minimum Editor Level: 1
    Country restrictions: none

    Create a report of segments, highlighted by WME Colour Highlights:
    1. In the Colour Highlights tab choose a selection of segments to highlight.
    2. Run WMET and get the list of permalinks to those segments.
  3. Report street/city name issues
    Minimum Editor Level: 3
    Country restrictions: none

    Create a list of segments with one of the following issues:
    • Might be incomplete city names (i.e. it reports "Krak" if "Kraków" is around)
    • City name on Railroads
    • City name on Freeways
    • Over 25 letters long street names
    • Street name on two-way Ramps
    • Street name on roundabouts
    • Double space in street names
    • Leading/trailing space in street names
    • No space before/after the abbreviation in street names
    • Empty alternate streets
    • Newly paved roads
  4. [PL] Report street/city name issues
    Minimum Editor Level: 3
    Country restrictions: works only in Poland

    Polish pack of checks. Create a list of segments with one of the following issues:
    • Incorrectly abbreviated street names
    • DKnum or DWnum in street names
    • "Węzel" on Ramps
    • "Rondo" in street names
    • City name on Ramps
    • Street name is not "PKP" on Railroads
Fixes
I decided to go a "safe way" with the fixes, so fixes are password protected. Moreover, all the fixes are country-specific, no general/worldwide fixes.

In order to unlock the fixes you need an activation code. The activation code will be provided to you only if you need it (i.e. there are fixes available for your country).

Expiration
To make WMET even more secure, the expiration dates are implemented.
This "release candidate" package expires: 2013-11-29
Every activation code has an expiration date as well.

How to download?
If you are a Global Waze Champ contact me in PM to get the download links.
CRX and user.js versions are available, tested in Chrome/Tampermonkey/Firefox.

What's next?
1. In a week I'd like to make the WMET available for everyone to download. So please let me know if I shall change any level/country restriction before this public release.

2. Please let me know if you are interesting in creating your country pack.

3. Ask me if you have any other questions.
berestovskyy
Posts: 912
Has thanked: 321 times
Been thanked: 832 times
Send a message