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 foxitrot
Olestas wrote:martinkolar, could you please add option to higlight speeds also on dirt roads, private roads and parking lot roads?
Possibly moving these "Other - Drivable" segment types out from "Non-Drivable" category could be sufficient. I do not think that they need some special color handling. They are drivable and pretty frequently the real roads, mapped with them, have real Speed Limits.
foxitrot
Waze Global Champs
Waze Global Champs
Posts: 7263
Has thanked: 1283 times
Been thanked: 649 times
Send a message
...with the good old crashing :roll: Symbian 2.1.99.114 (on N-E52), while
trying to get used to the good new asocial Android 4.xx.0.yyy (on OP-X March-me-Low).

Post by foxitrot
MartijnKeizer wrote:In the Netherlands, Private Roads cannot be set to a certain speed limit,
In no country a Private Road segment's SL can be set directly, but it is possible when temporarily using other segment type.
MartijnKeizer wrote: private roads are used fairly frequently,
If the real roads (for which you are using Private segments) do have speed limits, and I assume they do, I'd recommend setting them (with the mentioned workaround) and help us convincing the devs and Support to remove this weird limitation from "Other-drivables" segments.
MartijnKeizer wrote:however when using the script to highlight segments without speed limits set, the private roads get tagged too.
Sure they do. A Private Road segment has its SL attribute like any other segment type.
MartijnKeizer wrote: When using the script in this mode, the option to use a transparent overlay doesn't work either. These two issues combined make it pretty much impossible to work with this script, [...] and we're at 80-90% for speed limits for all normal segments. Could these issues be addressed?
The script would possibly require a bit more checkboxes and a different highlighting logic.

Sent from a touch display, which took care of perfectly scrambling my thoughts.
foxitrot
Waze Global Champs
Waze Global Champs
Posts: 7263
Has thanked: 1283 times
Been thanked: 649 times
Send a message
...with the good old crashing :roll: Symbian 2.1.99.114 (on N-E52), while
trying to get used to the good new asocial Android 4.xx.0.yyy (on OP-X March-me-Low).

Post by foxitrot
I understand you, I just strongly disagree with both parts of your sentence:
Bill473 wrote:However, since private roads should not have speed limits, it isn't helpful to tag them.
This was just a very bad idea on Waze side to block the possibility to directly set these segment types' SL.

Sent from a touch display, which took care of perfectly scrambling my thoughts.
foxitrot
Waze Global Champs
Waze Global Champs
Posts: 7263
Has thanked: 1283 times
Been thanked: 649 times
Send a message
...with the good old crashing :roll: Symbian 2.1.99.114 (on N-E52), while
trying to get used to the good new asocial Android 4.xx.0.yyy (on OP-X March-me-Low).

Post by FZ69617
Olestas wrote:Maybe it is possible to show different speeds on same segment not with dashed line, but with two lines on different sides of segment? To know which direction which speeds is?
Sure, everything is possible having enough amount of time. :D

Drawing a separate speed limit indicators at each side of the segment was also my initial idea. :) But, aside even non-trivial task related to implement it, the result would probably cause a slow down in rendering of the map. I also afraid, that it would not finally help too much, since you can easily check what a speed limit for each direction is with a single click selecting the segment.

The primary intent behind a dashed/dotted lines is in a quick visual indication that something is potentially wrong with a speed limits specified, and likely requires the editor's intervention.

Here are an examples of the line styles indicating various speed limit combinations you can see on the map, together with a short description:

https://s22.postimg.org/z6hubrqe9/speed ... coding.png

-- Edit --
Replaced picture attachement somehow externally changed.
FZ69617
Waze Local Champs
Waze Local Champs
Posts: 933
Has thanked: 36 times
Been thanked: 236 times
Send a message
Last edited by FZ69617 on Mon Apr 11, 2016 9:25 pm, edited 1 time in total.

Post by FZ69617
@MartijnKeizer, I just submitted a new version of the script to the @martinkolar's source code repository. A new version adds transparency option support to all the highlights the script provides. I believe this will solve your issue.
FZ69617
Waze Local Champs
Waze Local Champs
Posts: 933
Has thanked: 36 times
Been thanked: 236 times
Send a message

Post by GeekDriverPeaceful
This script causes the popup to give the message: "TypeError: Cannot read property 'checked' of null". It always occurs when I change from Event Mode to Default Mode. It will continue to give the same error when I change back to Event Mode. Here is the following console log:

Code: Select all

www.waze.com/:169 Uncaught TypeError: Cannot read property 'checked' of null
    at initialize.highlightSpeedsSegments (eval at <anonymous> (:2:297), <anonymous>:169:58)
    at initialize.triggerEvent (https://www.waze.com/assets-editor/js/vendor-30792e8abebc80c177fa.js:101:6363)
    at initialize.moveTo (https://www.waze.com/assets-editor/js/vendor-30792e8abebc80c177fa.js:105:30966)
    at initialize.setCenter (https://www.waze.com/assets-editor/js/vendor-30792e8abebc80c177fa.js:105:27363)
    at initialize.updateSize (https://www.waze.com/assets-editor/js/vendor-30792e8abebc80c177fa.js:105:25413)
    at https://www.waze.com/assets-editor/js/vendor-30792e8abebc80c177fa.js:99:14924

Uncaught TypeError: Cannot read property 'checked' of null
    at n.highlightSpeedsSegments (eval at <anonymous> (:2:297), <anonymous>:169:58)
    at f (https://www.waze.com/assets-editor/js/vendor-30792e8abebc80c177fa.js:2:23736)
    at M (https://www.waze.com/assets-editor/js/vendor-30792e8abebc80c177fa.js:2:23528)
    at h (https://www.waze.com/assets-editor/js/vendor-30792e8abebc80c177fa.js:2:21471)
    at n.l.trigger (https://www.waze.com/assets-editor/js/vendor-30792e8abebc80c177fa.js:2:23421)
    at s.a.events.on.loadend (https://www.waze.com/assets-editor/js/app-331809ae6037103cf5c5.js:4:18025)
    at initialize.triggerEvent (https://www.waze.com/assets-editor/js/vendor-30792e8abebc80c177fa.js:101:6363)
    at s.e.onLoadEnd (https://www.waze.com/assets-editor/js/vendor-30792e8abebc80c177fa.js:104:25392)
    at initialize.triggerEvent (https://www.waze.com/assets-editor/js/vendor-30792e8abebc80c177fa.js:101:6363)
    at initialize.onImageLoad (https://www.waze.com/assets-editor/js/vendor-30792e8abebc80c177fa.js:107:10712)

highlightSpeedsSegments @ VM10072:169
f @ vendor-30792e8….js:2
M @ vendor-30792e8….js:2
h @ vendor-30792e8….js:2
l.trigger @ vendor-30792e8….js:2
a.events.on.loadend @ app-331809a….js:4
triggerEvent @ vendor-30792e8….js:101
e.onLoadEnd @ vendor-30792e8….js:104
triggerEvent @ vendor-30792e8….js:101
onImageLoad @ vendor-30792e8….js:107
initImage @ vendor-30792e8….js:107
renderTile @ vendor-30792e8….js:107
draw @ vendor-30792e8….js:107
drawTileFromQueue @ vendor-30792e8….js:104
(anonymous) @ vendor-30792e8….js:99
i.(anonymous function) @ vendor-30792e8….js:99
2017-02-14 19:50:46.354 VM10072:169 Uncaught TypeError: Cannot read property 'checked' of null
    at highlightSpeedsSegments (eval at <anonymous> (:2:297), <anonymous>:169:58)
    at initialize.changeLayer (eval at <anonymous> (:2:297), <anonymous>:471:5)
    at initialize.triggerEvent (https://www.waze.com/assets-editor/js/vendor-30792e8abebc80c177fa.js:101:6363)
    at Object.<anonymous> (https://www.waze.com/assets-editor/js/app-331809ae6037103cf5c5.js:15:24236)
    at d (https://www.waze.com/assets-editor/js/vendor-30792e8abebc80c177fa.js:26:22569)
    at Object.fireWith [as resolveWith] (https://www.waze.com/assets-editor/js/vendor-30792e8abebc80c177fa.js:26:23337)
    at s (https://www.waze.com/assets-editor/js/vendor-30792e8abebc80c177fa.js:27:26413)
    at XMLHttpRequest.<anonymous> (https://www.waze.com/assets-editor/js/vendor-30792e8abebc80c177fa.js:28:232)
highlightSpeedsSegments @ VM10072:169
changeLayer @ VM10072:471
triggerEvent @ vendor-30792e8….js:101
(anonymous) @ app-331809a….js:15
d @ vendor-30792e8….js:26
fireWith @ vendor-30792e8….js:26
s @ vendor-30792e8….js:27
(anonymous) @ vendor-30792e8….js:28
GeekDriverPeaceful
Posts: 707
Has thanked: 453 times
Been thanked: 164 times
Send a message

Post by gertbroos
Hi

A problem was reported to me, that these scripts also run when a user is on his/her userpages, what results in a flood of messages in the console log window.

Adding the following 2 lines at the top of the script resolves this problem

Code: Select all

// @exclude https://www.waze.com/user/*editor/*
// @exclude https://www.waze.com/*/user/*editor/*
Kind regards
gertbroos
Waze Local Champs
Waze Local Champs
Posts: 375
Has thanked: 81 times
Been thanked: 290 times
Send a message

Post by Glodenox
There are some issues in the initialisation function. I've fixed these for you (unsafeWindow is not available in Google Chrome if you don't use any GM_* functions and the order of your checks wasn't correct). This worked in Firefox and Google Chrome for me.

Code: Select all

function initialiseSpeedsHighlights() {
  if (wmeSpeedsInit) {
    return;
  }

  // init shortcuts

  if (typeof(Waze) === 'undefined') {
    console.log("WME Speeds: Waze : NOK");
    setTimeout(initialiseSpeedsHighlights, 500);
    return;
  }

  if (!Waze.map) {
      window.console.log("WME Speeds: waiting for WME...");
      setTimeout(initialiseSpeedsHighlights, 555);
      return;
  }

  if (typeof(OpenLayers) === 'undefined') {
    console.log("WME Speeds: OpenLayers : NOK");
    setTimeout(initialiseSpeedsHighlights, 500);
    return;
  }

  if (wmeSpeedsAllowLanguage.indexOf(I18n.locale) != -1) {
    wmeSpeedsLanguage = I18n.locale;
  }

  wmeSpeedsLayer = new OpenLayers.Layer.Vector(fe_t('layerName'), {
    displayInLayerSwitcher: true,
    uniqueName: "__DrawSegmentSpeeds"
  });

  I18n.translations.en.layers.name["__DrawSegmentSpeeds"] = fe_t('scriptName');
  Waze.map.addLayer(wmeSpeedsLayer);

  if (localStorage.DrawSegmentSpeeds) {
    wmeSpeedsLayer.setVisibility(localStorage.DrawSegmentSpeeds == "true");
  } else {
    wmeSpeedsLayer.setVisibility(true);
  }

  // begin periodic updates
  window.setInterval(highlightSpeedsSegments,333);

  // trigger code when page is fully loaded, to catch any missing bits
  window.addEventListener("load", function(e) {
    var mapProblems = getId('map-problems-explanation')
    if (mapProblems !== null) mapProblems.style.display = "none";
  });

  if (Waze.model.isImperial) {
    wmeSpeedsMiles = true;
  }

  // register some events...
  Waze.map.events.register("zoomend", null, highlightSpeedsSegments);
  Waze.map.events.register("changelayer", null, changeLayer);

  wmeSpeedsInit = true;

  makeSpeedsTab();

  // restore saved settings
  if (localStorage.WMESpeedsScript) {
    console.log("WME Speeds: Loading Options");
    options = JSON.parse(localStorage.WMESpeedsScript);

    getId('_wmeSpeedsInvert').checked = options[1];
    getId('_wmeSpeedsDrivable').checked = options[3];
    getId('_wmeSpeedsTransparentColors').checked = options[4];
    getId('_wmeSpeedsUnverifed').checked = options[4];
  }

  // overload the WME exit function
  saveWmeSpeedsOptions = function() {
    if (localStorage) {
      console.log("WME Speeds: Saving Options");
      var options = [];

      // preserve previous options which may get lost after logout
      if (localStorage.WMESpeedsScript) {
        options = JSON.parse(localStorage.WMESpeedsScript);
      }

      options[1] = getId('_wmeSpeedsInvert').checked;
      options[3] = getId('_wmeSpeedsDrivable').checked;
      options[4] = getId('_wmeSpeedsTransparentColors').checked;

      localStorage.WMESpeedsScript = JSON.stringify(options);
    }
  }
  //  save options
  window.addEventListener("beforeunload", saveWmeSpeedsOptions, false);

  getId('_wmeSpeedsInvert').onclick = highlightSpeedsSegmentsReset;
  getId('_wmeSpeedsDrivable').onclick = highlightSpeedsSegmentsReset;
  getId('_wmeSpeedsTransparentColors').onclick = highlightSpeedsSegmentsReset;
  getId('_wmeSpeedsUnverifed').onclick = highlightSpeedsSegmentsReset;

  for (i = 0; i < wmeSpeedsColors.length; i++) {
    wmeSpeedsColorsTransparent[i] = 'rgba(' + hexToRgb(wmeSpeedsColors[i]).r + ', ' + hexToRgb(wmeSpeedsColors[i]).g + ', ' + hexToRgb(wmeSpeedsColors[i]).b + ', 0.4)';
    wmeSpeedsAvailableColor[wmeSpeedsAvailableColor.length] = wmeSpeedsColorsTransparent[i];
  }

  for (i = 0; i < wmeSpeedsColorsMph.length; i++) {
    wmeSpeedsColorsMphTransparent[i] = 'rgba(' + hexToRgb(wmeSpeedsColorsMph[i]).r + ', ' + hexToRgb(wmeSpeedsColorsMph[i]).g + ', ' + hexToRgb(wmeSpeedsColorsMph[i]).b + ', 0.4)';
    wmeSpeedsAvailableColor[wmeSpeedsAvailableColor.length] = wmeSpeedsColorsMphTransparent[i];
  }
}
Glodenox
Waze Global Champs
Waze Global Champs
Posts: 1569
Answers: 1
Has thanked: 278 times
Been thanked: 946 times
Send a message
Belgium & Luxembourg Coordinator • Script Writing Community Coordinator
https://www.tomputtemans.com/images/WazeBelgium.pnghttps://www.tomputtemans.com/images/WazeWMEbeta.png

Post by Glodenox
Hey there! I'm happy to see most of the references to the Waze object in this script have been replaced with the W object. There is still one line that need changing to have this script fully ready though:

Code: Select all

525:  if (typeof(Waze) === 'undefined') {
Otherwise the script will never initialize.

Also, please be aware that today's update will affect the several repository APIs, which will also affect this script:

Code: Select all

185:      var segment = W.model.segments.get(seg); // <- should become .getObjectById
Glodenox
Waze Global Champs
Waze Global Champs
Posts: 1569
Answers: 1
Has thanked: 278 times
Been thanked: 946 times
Send a message
Belgium & Luxembourg Coordinator • Script Writing Community Coordinator
https://www.tomputtemans.com/images/WazeBelgium.pnghttps://www.tomputtemans.com/images/WazeWMEbeta.png

Post by HairyDrumroll
Doesn't seem to be working for me. Have Tampermonkey installed, script installed, tab is visible in left, but roads aren't coloured. Ideas?
HairyDrumroll
Posts: 87
Has thanked: 35 times
Been thanked: 7 times
Send a message