Help with WME API to add roundabout helping

The place to get information and ask questions about everything to do with properly and successfully editing the Waze Map.

Use this forum for all general editing questions, and the sub-forums for specific types of Waze Map Editor features.

Moderator: Unholy

Help with WME API to add roundabout helping

Postby davipt » Fri Nov 23, 2012 11:53 am

Hello all,

I need some help from any WME API experts to try to implement a helping function for roundabouts. The end result is to be offered to an existing script or released as a standalone script.

The idea is to provide a visual guidance to the roundabout rules at the wiki, so editors can put the nodes at the right place to obtain the right instructions.

The problem is that at the moment I'm trying to change the highlights script and trying to draw some lines when a node is selected, as the node selection binding is already implemented there, but I don't know yet how to draw the lines.

For the first version I'd like to assume the roundabout is a pure circle, and draw 6 lines from the selected node to the opposite directions of the roundabout, marking the 3x2 relevant angles - 90+-30, 180+-30, 270+-30, so one can know where to put the other nodes to obtain the "straight ahead/turn left/turn right" or, when it's not perpendicular, the right "take the nth exit".

For completeness, the context is that in Portugal we have hundreds, if not some thousands of roundabouts, and after struggling with broken roundabouts, now I'm struggling to get the right instructions and have the script help me instead of putting a ruler over the screen.

Any WME script expert out there to help me?

PS: I've already pinged timbone to ask him this feature and offer my help and keep him posted of my progress.
ImageBruno D. Rodrigues | Global Champ
Coordinator for Portugal | Expert iPhone and others
Forum PT | Wiki PT | Facebook PT | Twitter PT
davipt
Waze Global Champs
Waze Global Champs
 
Posts: 2720
Joined: Tue Nov 02, 2010 8:51 am
Location: Oeiras, Portugal
Has thanked: 271 times
Been thanked: 547 times

Re: Help with WME API to add roundabout helping

Postby Timbones » Fri Nov 23, 2012 1:12 pm

It could be an interesting feature (thank you for your PM), but unfortunately I don't know how add new lines to the editor. So far, I've only hacked the lines that already exist on the map.

Twister's scripts are able to add boxes on top of the map, but I think that he's using a separate canvas on top of WME.

If you want to do it properly, have a look at the OpenLayers API - this is what WME uses to draw the road data.
Timbones(6) • UK Coordinator • Forum Moderator • Global Wiki Moderator • Routing Expert
Extensions: WME Colour HighlightsWME Route TesterWME Geometries
Timbones
Coordinators
Coordinators
 
Posts: 6170
Joined: Wed Feb 09, 2011 10:33 am
Location: York, UK
Has thanked: 762 times
Been thanked: 2204 times

Re: Help with WME API to add roundabout helping

Postby davipt » Fri Nov 23, 2012 4:02 pm

Status update: based on the existing scripts, I can now understand a node click, understand it's a roundabout, collect all roundabout nodes and segments. Now I'll try to understand the OpenLayers from the UR script...
ImageBruno D. Rodrigues | Global Champ
Coordinator for Portugal | Expert iPhone and others
Forum PT | Wiki PT | Facebook PT | Twitter PT
davipt
Waze Global Champs
Waze Global Champs
 
Posts: 2720
Joined: Tue Nov 02, 2010 8:51 am
Location: Oeiras, Portugal
Has thanked: 271 times
Been thanked: 547 times

Re: Help with WME API to add roundabout helping

Postby davipt » Fri Nov 23, 2012 4:29 pm

Status Update: as a side effect, I can now automatically create roundabout junction landmarks based on the roundabout geometry >:) Maybe I should keep this as a secondary feature :lol:

Screen Shot 2012-11-23 at 4.28.18 PM copy.jpg
Screen Shot 2012-11-23 at 4.28.18 PM copy.jpg (27.98 KiB) Viewed 2720 times
ImageBruno D. Rodrigues | Global Champ
Coordinator for Portugal | Expert iPhone and others
Forum PT | Wiki PT | Facebook PT | Twitter PT
davipt
Waze Global Champs
Waze Global Champs
 
Posts: 2720
Joined: Tue Nov 02, 2010 8:51 am
Location: Oeiras, Portugal
Has thanked: 271 times
Been thanked: 547 times

Re: Help with WME API to add roundabout helping

Postby davipt » Fri Nov 23, 2012 6:21 pm

And we have a prototype!

Screen Shot 2012-11-23 at 6.19.51 PM copy.jpg
Screen Shot 2012-11-23 at 6.19.51 PM copy.jpg (25.22 KiB) Viewed 2707 times
ImageBruno D. Rodrigues | Global Champ
Coordinator for Portugal | Expert iPhone and others
Forum PT | Wiki PT | Facebook PT | Twitter PT
davipt
Waze Global Champs
Waze Global Champs
 
Posts: 2720
Joined: Tue Nov 02, 2010 8:51 am
Location: Oeiras, Portugal
Has thanked: 271 times
Been thanked: 547 times

Re: Help with WME API to add roundabout helping

Postby Timbones » Fri Nov 23, 2012 7:54 pm

Good work!

via mobile
Timbones(6) • UK Coordinator • Forum Moderator • Global Wiki Moderator • Routing Expert
Extensions: WME Colour HighlightsWME Route TesterWME Geometries
Timbones
Coordinators
Coordinators
 
Posts: 6170
Joined: Wed Feb 09, 2011 10:33 am
Location: York, UK
Has thanked: 762 times
Been thanked: 2204 times

Re: Help with WME API to add roundabout helping

Postby zCougar » Sat Nov 24, 2012 9:45 pm

This looks cool. I also thought about implementing this but you are already there. Would like to use that as soon as possible ;-)

--
Cougar
Image
Waze 3.9.5.3: Nexus 4 | Nexus 5 | Nexus 7
CM@Estonia / WME beta tester / Android beta tester
PALUN LOE: Waze eestikeelne juhend wikis
zCougar
Waze Local Champs
Waze Local Champs
 
Posts: 892
Joined: Fri Mar 05, 2010 10:25 am
Location: Estonia
Has thanked: 207 times
Been thanked: 100 times

Re: Help with WME API to add roundabout helping

Postby davipt » Tue Nov 27, 2012 11:51 am

Here's a first version, please handle with care and provide as much feedback as possible ;)

http://userscripts.org/scripts/show/152981
ImageBruno D. Rodrigues | Global Champ
Coordinator for Portugal | Expert iPhone and others
Forum PT | Wiki PT | Facebook PT | Twitter PT
davipt
Waze Global Champs
Waze Global Champs
 
Posts: 2720
Joined: Tue Nov 02, 2010 8:51 am
Location: Oeiras, Portugal
Has thanked: 271 times
Been thanked: 547 times

Re: Help with WME API to add roundabout helping

Postby Dennis_Halmstad » Sun Jan 06, 2013 5:40 pm

Its a gr8 start.

It seams that it dont work if u use tampermonkey in chrome.
Its the way this script get acces to WME that causes problems. Other scripts with unsafeWindow works.
Samsung Gt-i9300 "Galaxy S3" Stock 4.1.2, Latest Waze beta.
ImageImage
Dennis_Halmstad
 
Posts: 148
Joined: Fri Feb 18, 2011 7:10 am
Location: Sweden
Has thanked: 0 time
Been thanked: 2 times

Re: Help with WME API to add roundabout helping

Postby davipt » Sun Jan 06, 2013 7:10 pm

Dennis_Halmstad wrote:Its a gr8 start.

It seams that it dont work if u use tampermonkey in chrome.
Its the way this script get acces to WME that causes problems. Other scripts with unsafeWindow works.


I've just copied verbatim what the other scripts were doing. I don't use chrome (I hate a browser that consumes 300MB every other week of my limited disk space) but I'll have a look at it when I can. I've tested it without any tampermonkey extension, and it was working out of the box.
ImageBruno D. Rodrigues | Global Champ
Coordinator for Portugal | Expert iPhone and others
Forum PT | Wiki PT | Facebook PT | Twitter PT
davipt
Waze Global Champs
Waze Global Champs
 
Posts: 2720
Joined: Tue Nov 02, 2010 8:51 am
Location: Oeiras, Portugal
Has thanked: 271 times
Been thanked: 547 times

Next

Return to Waze Map Editor

Who is online

Users browsing this forum: No registered users