Post Reply

[New Page] Bookmarklets

Post by
I am building a wiki page on Bookmarklets.

If anyone has created or is currently using any bookmarklets related to Waze map editing or other related matters, consider posting your content here and we can include it in the wiki page.

POSTER_ID:7009939

1

Send a message

Post by AlanOfTheBerg
There are some bookmarklets here which could be moved: https://wiki.waze.com/wiki/Map_Editing_ ... et_Scripts
AlanOfTheBerg
EmeritusChamps
EmeritusChamps
Posts: 23627
Has thanked: 568 times
Been thanked: 3479 times
Send a message
Wiki Resources: Map Editing Manual | alanoftheberg@gmail.com
Oregon-based US Ex-Global Champ Editor | iPhone13Pro - VZ

Post by AlanOfTheBerg
I have updated my bookmarklets page by removing old scripts and also updated the bookmarklets wiki page removing the Livemap-to-WME as it didn't work and Livemap has this functionality built in now.
AlanOfTheBerg
EmeritusChamps
EmeritusChamps
Posts: 23627
Has thanked: 568 times
Been thanked: 3479 times
Send a message
Wiki Resources: Map Editing Manual | alanoftheberg@gmail.com
Oregon-based US Ex-Global Champ Editor | iPhone13Pro - VZ

Post by AlanOfTheBerg
The extraneous nodes bookmarklet should be updated, and noted to NOT use it in areas where there are 1-way streets. For wide rural areas with extra junctions and all 2-way streets, it is very helpful.
AlanOfTheBerg
EmeritusChamps
EmeritusChamps
Posts: 23627
Has thanked: 568 times
Been thanked: 3479 times
Send a message
Wiki Resources: Map Editing Manual | alanoftheberg@gmail.com
Oregon-based US Ex-Global Champ Editor | iPhone13Pro - VZ

Post by brandonrossl
Is there a level-3-friendly version of the auto-lock? I can't seem to get it to work and it may be due to the fact that I'm only a level 3.

Thanks!
brandonrossl
Posts: 180
Has thanked: 63 times
Been thanked: 11 times
Send a message

Post by brandonrossl
That's weird, I tried both.

I do have 64-bit Chrome installed, don't know if that makes a difference.
brandonrossl
Posts: 180
Has thanked: 63 times
Been thanked: 11 times
Send a message


Post by brandonrossl
For me, it simply failed and didn't do anything.
brandonrossl
Posts: 180
Has thanked: 63 times
Been thanked: 11 times
Send a message

Post by crazycaveman
I have been playing around with the segment locks bookmarklet, and believe I have it fixed. Haven't done extensive testing yet, but here it is. Please let me know if you run into any issues; I'm new with this stuff and just used another bookmarklet I was given to hack this one enough to (seemingly) work.

Code: Select all

javascript:(function() {

  /* value used is -1 from rank visible in WME */
  /* fwy_lvl = 3 would appear locked at 4 in WME */
  /* can set locks to be null, which will use the auto-lock */
  var fwy_lvl = 3;
  var rmp_lvl = 3;
  var maj_lvl = 2;
  var min_lvl = 1;
  var pri_lvl = null;
  var absolute = false;
  var count = 0;
  
  function onScreen(obj) {
    if (obj.geometry) {
      return(W.map.getExtent().intersectsBounds(obj.geometry.getBounds()));
    }
    return(false);
  }
  
  Object.forEach(W.model.segments.objects, function(k, v) {
    if (count < 150 && onScreen(v) && v.isGeometryEditable()) {
      /* fwy */
      if (v.attributes.roadType == 3 && (v.attributes.lockRank == null || v.attributes.lockRank < fwy_lvl || (absolute && v.attributes.lockRank != fwy_lvl))) {
   count++;
        W.model.actionManager.add(new Waze.Action.UpdateObject(v, {lockRank: fwy_lvl}));
      }
      /* ramp */
      if (v.attributes.roadType == 4 && (v.attributes.lockRank == null || v.attributes.lockRank < rmp_lvl || (absolute && v.attributes.lockRank != rmp_lvl))) {
        count++;
        W.model.actionManager.add(new Waze.Action.UpdateObject(v, {lockRank: rmp_lvl}));
      }
      /* MH */
      if (v.attributes.roadType == 6 && (v.attributes.lockRank == null || v.attributes.lockRank < maj_lvl || (absolute && v.attributes.lockRank != maj_lvl))) {
        count++;
        W.model.actionManager.add(new Waze.Action.UpdateObject(v, {lockRank: maj_lvl}));
      }
      /* mH */
      if (v.attributes.roadType == 7 && (v.attributes.lockRank == null || v.attributes.lockRank < min_lvl || (absolute && v.attributes.lockRank != min_lvl))) {
        count++;
        W.model.actionManager.add(new Waze.Action.UpdateObject(v, {lockRank: min_lvl}));
      }
      /* primary */
      if (v.attributes.roadType == 2 && (v.attributes.lockRank == null || v.attributes.lockRank < pri_lvl || (absolute && v.attributes.lockRank != pri_lvl))) {
        count++;
        W.model.actionManager.add(new Waze.Action.UpdateObject(v, {lockRank: pri_lvl}));
      }
    }
  });
})();
crazycaveman
US Waze Champs
US Waze Champs
Posts: 857
Has thanked: 226 times
Been thanked: 441 times
Send a message

Post by crazycaveman
Updated again for the newest WME:

Code: Select all

javascript:(function() {

  /* value used is -1 from rank visible in WME */
  /* fwy_lvl = 3 would appear locked at 4 in WME */
  /* can set locks to be null, which will use the auto-lock */
  var fwy_lvl = 3;
  var rmp_lvl = 3;
  var maj_lvl = 2;
  var min_lvl = 1;
  var pri_lvl = 1;
  var absolute = false;
  var count = 0;
  var UpdateObject;
  
  if (typeof(require) !== "undefined") {
      UpdateObject = require("Waze/Action/UpdateObject");
  } else {
      UpdateObject = Waze.Action.UpdateObject;
  }

  function onScreen(obj) {
    if (obj.geometry) {
      return(W.map.getExtent().intersectsBounds(obj.geometry.getBounds()));
    }
    return(false);
  }
  
  Object.forEach(W.model.segments.objects, function(k, v) {
	if (count < 150 && onScreen(v) && v.isGeometryEditable()) {
	  /* fwy */
      if (v.attributes.roadType == 3 && (v.attributes.lockRank < fwy_lvl || (absolute && v.attributes.lockRank != fwy_lvl))) {
   count++;
        W.model.actionManager.add(new UpdateObject(v, {lockRank: fwy_lvl}));
      }
      /* ramp */
      if (v.attributes.roadType == 4 && (v.attributes.lockRank < rmp_lvl || (absolute && v.attributes.lockRank != rmp_lvl))) {
        count++;
        W.model.actionManager.add(new UpdateObject(v, {lockRank: rmp_lvl}));
      }
      /* MH */
      if (v.attributes.roadType == 6 && (v.attributes.lockRank < maj_lvl || (absolute && v.attributes.lockRank != maj_lvl))) {
        count++;
        W.model.actionManager.add(new UpdateObject(v, {lockRank: maj_lvl}));
      }
      /* mH */
      if (v.attributes.roadType == 7 && (v.attributes.lockRank < min_lvl || (absolute && v.attributes.lockRank != min_lvl))) {
        count++;
        W.model.actionManager.add(new UpdateObject(v, {lockRank: min_lvl}));
      }
      /* primary */
      if (v.attributes.roadType == 2 && (v.attributes.lockRank < pri_lvl || (absolute && v.attributes.lockRank != pri_lvl))) {
        count++;
        W.model.actionManager.add(new UpdateObject(v, {lockRank: pri_lvl}));
      }
    }
  });
})();
Default values:
Freeway = 4
Ramp = 4
Major Hwy = 3
Minor Hwy = 2
Primary Street = 2

Just had to change the Waze.Action.UpdateObject to UpdateObject

Edit 10/23: Updated script here to match the one in the wiki. Found that it didn't work if Toolbox wasn't installed.
crazycaveman
US Waze Champs
US Waze Champs
Posts: 857
Has thanked: 226 times
Been thanked: 441 times
Send a message
Last edited by crazycaveman on Thu Oct 23, 2014 6:49 pm, edited 1 time in total.

Post by crazycaveman
karlcr9911 wrote:Hey Crazycaveman - great script! Why the change from PS locking to a 2 to an Auto Lock now? Auto Lock isn't active in the US yet, is it?
Not yet. That's just the way I had it and was too lazy to change it :lol: Also, for my state, that's the main standard we're sticking with
crazycaveman
US Waze Champs
US Waze Champs
Posts: 857
Has thanked: 226 times
Been thanked: 441 times
Send a message