[Script] WME MagicWand

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

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.

[Script] WME MagicWand

Postby wasd42 » Thu Nov 20, 2014 2:52 pm

WME MagicWand
https://greasyfork.org/ru/scripts/6512-wme-magicwand

Features
  • Magic wand tool - the very same thing as in Photoshop: point on a pixel on the map, click and the tool will create a landmark covering whole area of the same color (see example GIF here)
  • Clone landmark (see GIF example here). With this simple tool plus rotate and resize feature (below) you can create dozens of houses in a minute! Press Ctrl (Cmd) + C to Clone.
  • Orthogonalize landmark corners - same tool as many of you have seen before in OpenStreetMaps iD editor, will make "almost" straight corners of the selected landmark perfectly straight thus making a beautiful landmarks in mobile clients :) See example here. Press Ctrl (Cmd) + X to Orthogonalize selected landmark.

    You can set "Enable Highlight" option ON to highlight those landmarks that need to be orthogonalized.
  • Rotate and resize landmarks option

WME MagicWand has been tested in Chrome and Firefox.
This is the early version, please report any bug you'll encounter and I'll try to fix it ASAP :)

Usage
Advanced editing tools
Clone landmark
Select a landmark you want to clone and press "Clone landmark" button on the left hand menu or use Ctrl (Cmd) + C shortcut. The landmark will be cloned with a same venue type but otherwise empty.

Orthogonalize landmark
Select a landmark and press "Orthogonalize" button on the left hand menu or use Ctrl (Cmd) + X shortcut. This algorithm will try to make "about" straight corners really strait to avoid ugly look in Waze client.

Simplify landmark
Remove excessive points in landmark geometry. Can be tuned by changing "Simplificate landmark" parameter in Magic Wand options tab.

Options for Rotation and Resize
- Open the MagicWand tab in the left menu;
- Check or uncheck boxes to enable or disable Rotate and Resize functionality;
- Select landmark;
- ROTATE: drag the additional landmark's vertice to rotate it;
- RESIZE: drag the additional landmark's vertice to resize. Please note that when RESIZE option is enabled you cannot modify individual vertices.

Magic Wand tool
- Open the MagicWand tab in the left menu;
- Choose the type of the supposed landmark (can be changed later);
- Toggle MAGIC WAND button: red means ACTIVE state;
- Click somewhere in the area you'd like to be converted to landmark based on the color (best work with farmland, water, building and forests);
- Wait a bit (the actual time depend on your computer) for landmark to be created;
- Edit the created landmark to fine tune the area.

Note
Error "Cannot create landmark, need at least 3 points to create polygon" means that the script was unable to find enough pixels of the similar colour where you clicked to build a concave hull. Please, try some other point nearby. Also, it happens that the server stops responding for tiles request for some reason, so try to refresh the page.

What does all that options mean?
Color match algorithm - WME MagicWand can use two different algorithms to detect similar pixels on the tiles: based on color "distance" and based on "human-eye similarity". Choose the best suitable option for you but please keep in mind that when changing algorithm you will need to play with Tolerance option too as both algorithms uses it differently.

Tolerance option basically changes sensitivity of the algorithm, what pixels would be supposed to have "similar" color. Large values will select all pixels -- that is not what you want :)

Landmark simplification - as map tiles contains tons of pixels of different color finding appropriate polygon to contain all of "similar" pixels is a difficult computational problem. Current implementation uses one of convex hull algorithms to do it. The problem is that it creates many points on the curves and corners and thus you can use simplification parameter to remove unnecessary points automatically.

Notes
* Please wait when map tiles will be fully loaded after moving or zooming to make plugin work properly.
* As far as I understand we can make the script more accurate if it will compare not individual pixels but certain groups, say 5x5 or 10x10. Need an advice about it though.

I'm really open for any suggestions and comments :)

Installation
- Download script using Install button in the right top corner;
- Open Options -> Tools -> Extensions page;
- Drag & Drop downloaded file to Extensions page.

Version history
2.1
- NEW: Highly experimental support of Magic Wand on custom layers via Map Overlays browser extension (https://chrome.google.com/webstore/deta ... babdkfbbia). Please, do not use layers for editing the maps unless you comply with the terms of use specific to each layer provider.

2.0.1
- FIX: Fixed Rotate and Resize options

2.0
- NEW: Finally, I've managed to implement a correct concave hull algorithm, which means that now complex landmarks will be correctly covered! Thanks, AndriiHeonia, for the lib!
- FIX: Plugin was broken after the Editor updates

1.0
- NEW: Highlight mode: set a Enable Highlight checkbox ON to highlight landmarks to be Orthogonalized.
- Compatibility with newer Editor version
- Minor fixes (thanks skirda!)
0.9
- NEW (requested by Griev0us): Landmark simplification using OpenLayers build-in simplify method for polygons. You can tune the algorithm by setting "Simplify landmark" parameter on MagicWand settings tab.

0.8.2
- NEW: Auto-select created landmark after clone operation

0.8.1
- FIX: compatibility issues with new Editor version fixed

0.8
- NEW (Requested by AlanOfTheBerg): Resize and Rotate checkboxes moved to "Selected Landmark" tab
- NEW: Introduced "Angle threshold" option to allow user to make Orthogonalize method more or less aggressive
- FIX (Reported by davielde): "undefined" options in Landmark removed
- CHANGE (Requested by sketch): "CLICK TO START MAGIC WAND" changed to "CLICK TO STOP MAGIC WAND" while it was active

0.7
- NEW: Options will be saved between session
- NEW: Hotkeys: Press Ctrl (Cmd) + C to Clone or Ctrl (Cmd) + X to Orthogonalize selected landmark

0.6
- NEW: Orthogonalize functionality for landmarks: now you can easily make a perfect straight angles on your landmarks
- Updated to support Venues and Places update

0.5
- NEW: Advanced Editing options for landmarks rotation and resize

0.3
- NEW: added sampling box setting
- CHANGED: a bit better UI
- FIX: Stability fixes
- FIX: Firefox performance hugely improved
0.2
- Stability fixes
0.1
- Initial release
Last edited by wasd42 on Mon Mar 20, 2017 3:56 pm, edited 7 times in total.
wasd42
Area Manager
Area Manager
 
Posts: 30
Joined: Sun Sep 09, 2012 6:19 pm
Location: Moscow, Russia
Has thanked: 10 times
Been thanked: 38 times

Re: [Script] WME MagicWand

Postby Fredo-p » Thu Nov 20, 2014 4:51 pm

This is amazing.
Fredo-p
Beta tester
Beta tester
 
Posts: 1991
Joined: Mon Aug 05, 2013 4:35 am
Location: AZ, NJ, NY, ND, CA
Has thanked: 270 times
Been thanked: 637 times

Re: [Script] WME MagicWand

Postby davielde » Thu Nov 20, 2014 4:56 pm

This is a very creative script. Thank you.

In the "Landmark Type" menu, there are numerous Undefined options at the bottom. When you select Undefined, attempting to save the venue provides an I18n translation error for the Category.
http://i.imgur.com/ARpfX0q.png
davielde
 
Posts: 1219
Joined: Tue Sep 17, 2013 2:01 pm
Location: Michigan, USA
Has thanked: 469 times
Been thanked: 758 times

Re: [Script] WME MagicWand

Postby AlanOfTheBerg » Thu Nov 20, 2014 5:36 pm

In Chrome/Win7 Tampermonkey, once the Magic Wand creates a landmark, there are no geometry handles so I cannot change the shape.

EDIT: I found that when the "resize landmark" option is checked, the geometry nodes disappear. And now I re-read the notes that found this is a known situation. Why is it this way?
AlanOfTheBerg
Waze Global Champs
Waze Global Champs
 
Posts: 23614
Joined: Sat Aug 28, 2010 8:48 pm
Location: US Country Manager - Oregon, USA
Has thanked: 1128 times
Been thanked: 4823 times

Re: [Script] WME MagicWand

Postby wasd42 » Thu Nov 20, 2014 9:43 pm

Thanks everyone, your comments are very important for me!

davielde wrote:In the "Landmark Type" menu, there are numerous Undefined options at the bottom. When you select Undefined, attempting to save the venue provides an I18n translation error for the Category.

Confirmed bug, I'll take a look at it, thanks.

AlanOfTheBerg wrote:I found that when the "resize landmark" option is checked, the geometry nodes disappear. And now I re-read the notes that found this is a known situation. Why is it this way?

That is a restriction set by OpenLayers library (mapping framework used by Waze Editor). I'll try to figure something out, maybe a custom control. Thank you.
wasd42
Area Manager
Area Manager
 
Posts: 30
Joined: Sun Sep 09, 2012 6:19 pm
Location: Moscow, Russia
Has thanked: 10 times
Been thanked: 38 times

Re: [Script] WME MagicWand

Postby AlanOfTheBerg » Thu Nov 20, 2014 10:38 pm

wasd42 wrote:That is a restriction set by OpenLayers library (mapping framework used by Waze Editor). I'll try to figure something out, maybe a custom control. Thank you.

Perhaps you could put the option as a button on the tab when the Place is selected, instead of on the Magic Wand tab, and then when a Place is selected, I can choose to click the Resize button to do the change, rather than having to go back to the Magic Wand tab?
AlanOfTheBerg
Waze Global Champs
Waze Global Champs
 
Posts: 23614
Joined: Sat Aug 28, 2010 8:48 pm
Location: US Country Manager - Oregon, USA
Has thanked: 1128 times
Been thanked: 4823 times

Re: [Script] WME MagicWand

Postby sketch » Thu Nov 20, 2014 11:08 pm

VERY COOL!

It would be nice if "CLICK TO START MAGIC WAND" changed to "CLICK TO STOP MAGIC WAND" while it was active.
sketch
Waze Global Champs
Waze Global Champs
 
Posts: 6132
Joined: Sat Aug 08, 2009 6:13 pm
Location: New Orleans, LA
Has thanked: 1581 times
Been thanked: 2133 times

Re: [Script] WME MagicWand

Postby wasd42 » Wed Dec 03, 2014 2:36 pm

Script has been updated to v.0.8 with following changes:
- NEW (Requested by AlanOfTheBerg): Resize and Rotate checkboxes moved to "Selected Landmark" tab
- NEW: Introduced "Angle threshold" option to allow user to make Orthogonalize method more or less aggressive
- FIX (Reported by davielde): "undefined" options in Landmark removed
- CHANGE (Requested by sketch): "CLICK TO START MAGIC WAND" changed to "CLICK TO STOP MAGIC WAND" while it was active
wasd42
Area Manager
Area Manager
 
Posts: 30
Joined: Sun Sep 09, 2012 6:19 pm
Location: Moscow, Russia
Has thanked: 10 times
Been thanked: 38 times

Re: [Script] WME MagicWand

Postby spookyx » Wed Dec 10, 2014 12:42 pm

Nice work.

Suggestion: can you add a setting so we can set the no city to the landmark just created.

How settings are the best for setting to follow closer the edge of the color? I kept trying different settings and no good result so far... but sill happy about this extension as it allows me to map rapidly small packs of forests.

For example, to be able to map the forest better like in the attached image, based on your experience and knowing better what the algorithm does, what do you recommend?

magicwand.png
(1.67 MiB) Downloaded 5543 times


Thanks.
spookyx
Waze Global Champs
Waze Global Champs
 
Posts: 1880
Joined: Mon Nov 15, 2010 12:46 pm
Location: Bucharest, Romania
Has thanked: 80 times
Been thanked: 582 times

Re: [Script] WME MagicWand

Postby Olestas » Thu Mar 05, 2015 8:51 am

Great script. But it does not allow to use Ctrl+c - copy combination. Selected text is not copied. If I disable script - text can be copied.
Olestas
Coordinators
Coordinators
 
Posts: 5854
Joined: Wed Mar 09, 2011 7:08 pm
Location: Latvia
Has thanked: 2867 times
Been thanked: 2082 times

Next

Return to Addons, Extensions, and Scripts

Who is online

Users browsing this forum: bz2012, mudge42, P2P1800