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 JustinS83
Numerous changes to WME since the production push yesterday/today broke this script. I have reached out to the author but he hasn't been in the forum since July, so outlined below are the changes that I made to fix the script.

To get it to work in the beta editor change

Code: Select all

// @include			https://editor-beta.waze.com/*
to

Code: Select all

// @include			https://beta.waze.com/*
To fix the script since WME update yesterday:

Change all instances of:

Code: Select all

 W.geometryEditing.editors.venue
to

Code: Select all

W.geometryEditing.activeEditor

Change the removeDragCallbacks function to this (starts at roughly line 112 and goes to 123):

Code: Select all

function removeDragCallbacks() {
        if(!W.geometryEditing.activeEditor == null){
            W.geometryEditing.activeEditor.dragControl.onDrag = function (e, t) {
                W.geometryEditing.activeEditor.dragVertex.apply(W.geometryEditing.activeEditor.venue, [e, t]);
            };
            if (null !== typeof navPoint) {
                try {
                    navPoint.events.unregister('drag', W.geometryEditing.activeEditor.venue, findNearestSegment);
                } catch (err) { }
            }
        }
		clearLayerFeatures();
	}
Some things need changed & moved around in the checkSelection function, so I will just paste the changes here. Copy and paste over the entire function (starts around line 194 and ends at roughly 238)

Code: Select all

	function checkSelection() {
		'use strict';
		log('Selection change called.', 2);


		if (!checkConditions()) {
			removeDragCallbacks();
		} else {
			if (W.selectionManager.hasSelectedItems()) {
				selectedItem = W.selectionManager.selectedItems[0];
				if ('venue' !== selectedItem.model.type) {
					log('Selection is not a place.', 2);
					removeDragCallbacks();
					clearLayerFeatures();
				} else {
                    
                    navPoint = W.geometryEditing.activeEditor.navigationPoint;
					getSegmentsInExtent();
					if (selectedItem.model.isPoint()) {
						log('Selection is point venue.', 2);
						W.geometryEditing.activeEditor.dragControl.onDrag = function (e, t) {
							W.geometryEditing.activeEditor.venue.dragVertex.apply(W.geometryEditing.activeEditor.venue, [e, t]);
							findNearestSegment();
						};
						findNearestSegment();
					} else {
						log('Selection is area venue.', 2);
						if (null !== typeof navPoint) {
							navPoint.events.register('drag', W.geometryEditing.activeEditor.venue, findNearestSegment);
							if (inMapExtent(navPoint.lonlat.toPoint())) {
								findNearestSegment();
							} else {
								log('navPoint not on screen.', 2);
								W.map.events.register('moveend', window, handleNavPointOffScreen);
							}
						}
					}
				}
			} else {
				log('No item selected.', 2);
				removeDragCallbacks();
				clearLayerFeatures();
			}
		}
	}
JustinS83  
Waze Global Champs
Waze Global Champs
Posts: 1463
Has thanked: 215 times
Been thanked: 2389 times
Send a message

Post by JustinS83
A few more changes. Moving a point Place wasn't registering to be saved.

Comment out line 214 (place "//" in front of it as seen below):

Code: Select all

W.geometryEditing.activeEditor.dragControl.onDrag = function (e, t) {
							//W.geometryEditing.activeEditor.venue.dragVertex.apply(W.geometryEditing.activeEditor, [e, t]);
							findNearestSegment();
		};
as it does not seem to be needed anymore & dragVertex no longer exists (that I can find).


Since the license seems to allow redistributing with minor changes to the code to fix the issue, here is a link to easily copy & paste the script in its entirety, with my changes to get it working since the latest WME release.

JustinS83  
Waze Global Champs
Waze Global Champs
Posts: 1463
Has thanked: 215 times
Been thanked: 2389 times
Send a message

Post by JustinS83
russblau wrote:Even after making these changes (thanks, Justin), this script is still giving me fits today. If I try to move a geometry node on a street, or a junction node, the change does not appear on the screen (the node appears to float away from the street segment), and cannot be saved. Turning off Closest Segment eliminates the issue.
I just loaded a new tab with the script enabled with these changes and am not seeing any of the mentioned issues. Did you make the changes or copy from the pastebin link at the end of the 2nd post? I would suggest copying from pastebin since that was copied from my locally modified copy of the script after getting it working.

If you are still experiencing issues, open your console (F12 in Chrome then go to the Console tab) and take a screenshot of any errors and send them to me and I can take a look.
JustinS83  
Waze Global Champs
Waze Global Champs
Posts: 1463
Has thanked: 215 times
Been thanked: 2389 times
Send a message

Post by JustinS83
onryou wrote:Hi,

I meet a problem with another script and I'm not the only one.

When Closest segment is activated we can't use speedhelper and when I select a segment and I click on "Select entire road", it does'nt work.

I desactive your script and I work again.

Thanks for your reply
onryou
Onryou,

Try the fix from this post.
JustinS83  
Waze Global Champs
Waze Global Champs
Posts: 1463
Has thanked: 215 times
Been thanked: 2389 times
Send a message

Post by JustinS83
taco909 wrote:For those applying fixes, please remember that once the code is modified, Greasemonkey will no longer automatically update when (or if) the original author publishes an update.
I can't say for Greasemonkey, but Tampermonkey will still update it after making code changes as long as you don't change the @namespace line.
JustinS83  
Waze Global Champs
Waze Global Champs
Posts: 1463
Has thanked: 215 times
Been thanked: 2389 times
Send a message

Post by JustinS83
Looks like the beta changed that removed "require" was pushed. Most scripts are going to be down.
JustinS83  
Waze Global Champs
Waze Global Champs
Posts: 1463
Has thanked: 215 times
Been thanked: 2389 times
Send a message

Post by JustinS83
I updated the pastebin code to remove the @require statement for wLib since it isn't used at all in the script and what is causing the script to be non-functional since the WME update.

Pastebin link:
JustinS83  
Waze Global Champs
Waze Global Champs
Posts: 1463
Has thanked: 215 times
Been thanked: 2389 times
Send a message

Post by JustinS83
Update released - version 1.0.2.3

Bug fix: when changing from a point to an area you couldn't adjust the area geometry until you saved and then re-selected the place.
JustinS83  
Waze Global Champs
Waze Global Champs
Posts: 1463
Has thanked: 215 times
Been thanked: 2389 times
Send a message

Post by JustinS83
jwe252 wrote:Cannot delete a place with this script enabled since the update.
Sorry about that!

Updated released - version 1.0.2.4
Bug fix - could not delete Places after the previous update.
JustinS83  
Waze Global Champs
Waze Global Champs
Posts: 1463
Has thanked: 215 times
Been thanked: 2389 times
Send a message

Post by JustinS83
G_W1Z wrote:
JustinS83 wrote:
jwe252 wrote:Cannot delete a place with this script enabled since the update.
Sorry about that!

Updated released - version 1.0.2.4
Bug fix - could not delete Places after the previous update.
Thanks for releasing these updates! I can save with the new release but it isn't showing the line from the PP to the nearest road.
I haven't had any issue with the line not showing. Please check your console for errors.
JustinS83  
Waze Global Champs
Waze Global Champs
Posts: 1463
Has thanked: 215 times
Been thanked: 2389 times
Send a message