[Script] WME Validator 2020.04.12 (PLACES BETA)

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.

Moderators: Unholy, bextein, Glodenox, JustinS83

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.

Re: [Script] WME Validator 1.1.19 / 04.06.2016

Postby dbcm » Mon Aug 29, 2016 9:05 am

Hi guys, i've a request for you.

I found a problem that WME Validator is not warning us about.

In a nutshell, there is a segment with one way, pointing to a dead-end, connected are one or more segments with a red arrow to that segment.

Basically you have a blackhole and you don't want people to go in.

You can see it here:
https://www.waze.com/editor/?env=row&lo ... ,140027351

in case someone fix this, here are the screenshots.

[ img ]
[ img ]


I'm detecting this issue with this prototype code:

Code: Select all
// check if you can drive from seg1 to seg2
var hasGreenFlag = function(seg, segs) {
/*
    var x = Waze.model.nodes.get(150020468);
    var s = Waze.model.segments.get(140026991);
    var s2 = Waze.model.segments.get(140027351);
    var s3 = Waze.model.segments.get(140027352);
    x.getDirectionBetweenSegments(s, s2);
    x.getDirectionBetweenSegments(s2, s);
    x.getDirectionBetweenSegments(s, s3);
    x.getDirectionBetweenSegments(s3, s);
    s2.attributes.toConnections[140026991]
*/
           
   var att = seg.attributes;
   var segId = att.id;
   
   debugger;

   for (var i = 0; i < segs.length; i++) {
      var nodeSegId = segs[i];
      if (segId === nodeSegId)
         continue;

        var nodeSeg = Waze.model.segments.get(nodeSegId);
       
        if (nodeSeg.attributes.toConnections[segId] === true) {
            return true;
        }
        if (nodeSeg.attributes.fromConnections[segId]=== true) {
            return true;
        }
       
    }
   
    return false;

}

// fix one way segments that connects to a black hole
var fxcOneWay2BlackHole = function(seg) {
   seg = Waze.model.segments.get(140026991);

   if (document.getElementById('fxc-oneway2blackhole').checked !== true) {
      return;
   }

   var attributes = seg.attributes;
   var segRoadType = attributes.roadType;

   // only process road cars...
   if (!isDrivable(seg)) {
      return;
   }

   var segId = attributes.id;
   var segRevDir = attributes.revDirection;
   var segFwdDir = attributes.fwdDirection;
   
   
   if (segRevDir === false && segFwdDir === false) {
      return;
   }
      
   if (segRevDir === false || segFwdDir === false) {
      var fromNodeId = attributes.fromNodeID;
      var fromNode = Waze.model.nodes.get(fromNodeId);
      var toNodeId = attributes.toNodeID;
      var toNode = Waze.model.nodes.get(toNodeId);

      var toNodeSegIDs = Waze.model.nodes.objects[toNodeId].attributes.segIDs;
      var fromNodeSegIDs = Waze.model.nodes.objects[fromNodeId].attributes.segIDs;

      if ((segFwdDir === false && fromNodeSegIDs.length === 1) ||
         (segRevDir === false && toNodeSegIDs.length === 1)) {
         doLog("Oh no! One way to a black hole!!!!");

         //debugger;

         var fattr = {};
         fattr.revDirection = fattr.fwdDirection = true;
         setSegmentAttributes(seg, fattr);

         var WazeActionModifyConnection = require("Waze/Action/ModifyConnection");
         if (fromNodeSegIDs.length === 1) {
                var oneGreenFlag = hasGreenFlag(seg, toNodeSegIDs);
               
            for (var j = 0; j < toNodeSegIDs.length; j++) {
               var toNodeSegID = toNodeSegIDs[j];
               if (segId === toNodeSegID)
                  continue;

               var toNodeSeg = getSegment(toNodeSegID);
               if (isDrivable(toNodeSeg)) {
                  Waze.model.actionManager.add(new WazeActionModifyConnection(segId, toNode, toNodeSegID, true));
                        // if what you have is red flags, put them all green
                        if (!oneGreenFlag) {
                      Waze.model.actionManager.add(new WazeActionModifyConnection(toNodeSegID, toNode, segId, true));
                        }
               } else {
                  doLog("Oh LOOK, drivable connected to non-drivable!!!");
               }
            }
         }
         if (toNodeSegIDs.length === 1) {
                var oneGreenFlag = hasGreenFlag(seg, fromNodeSegIDs);
               
            for (var i = 0; i < fromNodeSegIDs.length; i++) {
               var fromNodeSegID = fromNodeSegIDs[i];
               if (segId === fromNodeSegID)
                  continue;

               var fromNodeSeg = getSegment(fromNodeSegID);
               if (isDrivable(fromNodeSeg)) {
                  //console.log(segId+" _ "+ fromNodeSegID);
                  Waze.model.actionManager.add(new WazeActionModifyConnection(segId, fromNode, fromNodeSegID, true));
                        // if what you have is red flags, put them all green
                        if (!oneGreenFlag) {   
                            Waze.model.actionManager.add(new WazeActionModifyConnection(fromNodeSegID, fromNode, segId, true));
                        }
               } else {
                  doLog("Oh LOOK, drivable connected to non-drivable!!!");
               }
            }
         }
      }
   }

}
It's so Magic™ | Y U N0 W0RK? ¯\_(ツ)_/¯
dbcm
Coordinators
Coordinators
 
Posts: 623
Joined: Mon Feb 08, 2010 12:25 pm
Location: Berlengas, Portugal
Has thanked: 266 times
Been thanked: 687 times

Re: [Script] WME Validator 1.1.20 / 03.11.2016

Postby dbcm » Mon Feb 13, 2017 9:44 am

In the case you are using WME Validator through Tampermonkey, here is a fix.

https://github.com/dbcm/waze#valfix-tm-plugin
It's so Magic™ | Y U N0 W0RK? ¯\_(ツ)_/¯
dbcm
Coordinators
Coordinators
 
Posts: 623
Joined: Mon Feb 08, 2010 12:25 pm
Location: Berlengas, Portugal
Has thanked: 266 times
Been thanked: 687 times

Re: [Script] WME Validator 1.1.20 / 03.11.2016

Postby dbcm » Mon Feb 13, 2017 7:27 pm

Glodenox wrote:I've been able to get this to work consistently in Firefox after a couple of changes to the code of dbcm. The if statement around the proxy for require was unnecessary and I had to use window.require instead of just require to get it to work with GreaseMonkey. I've uploaded my version to GreasyFork, but I'd gladly take it down again if dbcm adjusts his version so it works on Firefox as well. I've checked with TamperMonkey and this new version works there as well.


In case you want to merge the code, do a pull request.
https://github.com/dbcm/waze/pulls

Double check that works also in Chrome with Tampermonkey
It's so Magic™ | Y U N0 W0RK? ¯\_(ツ)_/¯
dbcm
Coordinators
Coordinators
 
Posts: 623
Joined: Mon Feb 08, 2010 12:25 pm
Location: Berlengas, Portugal
Has thanked: 266 times
Been thanked: 687 times

Re: [Script] WME Validator 1.1.20 / 03.11.2016

Postby dbcm » Mon Feb 13, 2017 8:41 pm

Glodenox wrote:...



Teamwork is awesome sauce
It's so Magic™ | Y U N0 W0RK? ¯\_(ツ)_/¯
dbcm
Coordinators
Coordinators
 
Posts: 623
Joined: Mon Feb 08, 2010 12:25 pm
Location: Berlengas, Portugal
Has thanked: 266 times
Been thanked: 687 times

Re: [Script] WME Validator 1.1.20 / 03.11.2016

Postby dbcm » Wed Mar 15, 2017 3:38 pm

valFix 1.0.3 is out
https://dbcm.github.com/waze/valfix/valfix.user.js

Also adds Validator to layer menu.


Thanks to justins83
Last edited by dbcm on Wed Mar 15, 2017 4:09 pm, edited 1 time in total.
It's so Magic™ | Y U N0 W0RK? ¯\_(ツ)_/¯
dbcm
Coordinators
Coordinators
 
Posts: 623
Joined: Mon Feb 08, 2010 12:25 pm
Location: Berlengas, Portugal
Has thanked: 266 times
Been thanked: 687 times

Re: [Script] WME Validator 1.1.20 / 03.11.2016

Postby dbcm » Wed Mar 15, 2017 4:21 pm

valFix 1.0.4 is out to enforce layer menu

https://dbcm.github.io/waze/valfix/valfix.user.js

it will appear after 5 seconds, ±
It's so Magic™ | Y U N0 W0RK? ¯\_(ツ)_/¯
dbcm
Coordinators
Coordinators
 
Posts: 623
Joined: Mon Feb 08, 2010 12:25 pm
Location: Berlengas, Portugal
Has thanked: 266 times
Been thanked: 687 times

Re: [Script] WME Validator 1.1.20 / 03.11.2016

Postby dbcm » Sat Jul 01, 2017 6:48 am

Let him die, they say. LET. HIM. DIE™.

Something new is coming. soon™

[ img ]
It's so Magic™ | Y U N0 W0RK? ¯\_(ツ)_/¯
dbcm
Coordinators
Coordinators
 
Posts: 623
Joined: Mon Feb 08, 2010 12:25 pm
Location: Berlengas, Portugal
Has thanked: 266 times
Been thanked: 687 times

Re: [Script] WME Validator \ CONST ZN

Postby dbraughlr » Thu Jan 30, 2014 8:24 am

I request additional options:
  • Exclude any segment with name containing "CONST ZN".
  • Flag any segments with name containing "CONST ZN".
dbraughlr
 
Posts: 569
Joined: Tue Aug 13, 2013 2:24 am
Has thanked: 164 times
Been thanked: 98 times

Re: [Script] WME Validator 0.5.8 (BETA) / 31.01.2014

Postby dbraughlr » Sun Feb 02, 2014 9:23 am

dbraughlr
 
Posts: 569
Joined: Tue Aug 13, 2013 2:24 am
Has thanked: 164 times
Been thanked: 98 times

Re: [Script] WME Validator 0.5.8 (BETA) / 31.01.2014

Postby dbraughlr » Sun Feb 02, 2014 9:13 pm

berestovskyy wrote:So I remove all exceptions but the "to" for the ramps, right?

For the first word of any street name, yes. Not every connector is a ramp, so road type is not a factor. If the first word is "to", it should be lowercase.

There exists a street (deKoven Dr, Middletown, CT) which starts with two lowercase letters on the BGS. This is a name, not a word, and isn't going to appear on a list; rather it is detectable by the pattern that that it matches 'de' followed immediately by a capital letter (not a space). This is the only example so far I have seen for the entire USA of a street name that is not capitalized. Some might described it as a quirk, oddity, or affectation.
dbraughlr
 
Posts: 569
Joined: Tue Aug 13, 2013 2:24 am
Has thanked: 164 times
Been thanked: 98 times

PreviousNext

Return to Addons, Extensions, and Scripts

Who is online

Users browsing this forum: age4670, JimboBaggins1966, jm6087, Mapman44