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.

Post Reply

Papyrus <-> Cartouche Bookmarklets

Post by AlanOfTheBerg
Here are code snippets to be used as bookmarklets to help you switch between Papyrus and Cartouche. They work for both NA and world servers. They were previously published as separate threads, but I wanted to bring them together.

For a drag-and-drop solution, please see this page.

Open Papyrus in Cartouche:

Code: Select all

javascript:(function(){var center_lonlat=new OpenLayers.LonLat(wazeMap.center.lon,wazeMap.center.lat);center_lonlat.transform(new OpenLayers.Projection('EPSG:900913'),new OpenLayers.Projection('EPSG:4326'));window.open('http://'+window.location.hostname+'/cartouche_old/?zoom='+(wazeMap.zoom)+'&lon='+center_lonlat.lon+'&lat='+center_lonlat.lat,'oldCartouche');})();
Open Papyrus in LiveMap:

Code: Select all

javascript:(function(){var center_lonlat=new OpenLayers.LonLat(wazeMap.center.lon,wazeMap.center.lat);center_lonlat.transform(new OpenLayers.Projection("EPSG:900913"),new OpenLayers.Projection("EPSG:4326"));var mapZoom=(window.location.hostname=='world.waze.com' ? (wazeMap.zoom<5 ? (wazeMap.zoom<2 ? wazeMap.zoom+6 : wazeMap.zoom+5) : 9) : (wazeMap.zoom>10 ? wazeMap.zoom-11 : 0));window.open('http://'+window.location.hostname+'/livemap/?zoom='+mapZoom+'&lon='+center_lonlat.lon+'&lat='+center_lonlat.lat,'LiveMap');})();
Open LiveMap in Papyrus:

Code: Select all

javascript:(function(){var center_lonlat=OpenLayers.Layer.SphericalMercator.inverseMercator(g_map.getCenter().lon,g_map.getCenter().lat);var mapZoom=(window.location.hostname=='world.waze.com' ? (g_map.zoom>6 ? (g_map.zoom>7 ? g_map.zoom-5 : g_map.zoom-6) : 0) : (g_map.zoom>10 ? g_map.zoom-11 : 0));window.open('http://'+window.location.hostname+'/cartouche/?zoom='+mapZoom+'&lon='+center_lonlat.lon+'&lat='+center_lonlat.lat,'Papyrus');})();
Open Cartouche in Papyrus:

Code: Select all

javascript:(function(){var center_lonlat=new OpenLayers.LonLat(g_cartouche.map.center.lon,g_cartouche.map.center.lat);center_lonlat.transform(new OpenLayers.Projection('EPSG:900913'),new OpenLayers.Projection('EPSG:4326'));window.open('http://'+window.location.hostname+'/cartouche/?zoom='+(g_cartouche.map.zoom)+'&lon='+center_lonlat.lon+'&lat='+center_lonlat.lat,'Papyrus');})();
This code heavily relies on previous threads in the forum, which I won't link to because I've been asked not to. :)
AlanOfTheBerg
EmeritusChamps
EmeritusChamps
Posts: 23627
Has thanked: 568 times
Been thanked: 3479 times

POSTER_ID:701618

1

Send a message
Last edited by AlanOfTheBerg on Thu Nov 03, 2011 4:31 pm, edited 1 time in total.
Reason: unstickied as Info now contained in the wiki
Wiki Resources: Map Editing Manual | alanoftheberg@gmail.com
Oregon-based US Ex-Global Champ Editor | iPhone13Pro - VZ

Post by AlanOfTheBerg
I don't feel comfortable posting that code as it implies a link to other mapping systems, which could be a licensing issue. I had posted that code to the wiki before and had to take it down. If you have the other code, it is a pretty straightforward copy-paste-slight tweak job.
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
Edited original post with a link to a page I built which has drag-n-drop bookmarklets.

Known bug in Chrome (Mac only?) where Chrome doesn't add the name to the bookmarklet. You'll have to do that manually.
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
Updated code and bookmarklets due to hostname change from descartes(w) back to the main www and world server hostnames.
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
Timbones wrote:Can we have one to switch from Papyrus to the Livemap?.
Done. Added to OP.
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
jenncard wrote:
AlanOfTheBerg wrote: For a drag-and-drop solution, please see this page.
Thanks for the heads-up. This is fixed. The dangers of using javascript which uses double quotes for strings instead of single inside of an HTML element which requires double-quotes...

Updated the code in the OP to match.
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
Updated OP with LiveMap to Papyrus code. Bookmarklet drag-n-drop file has not been updated yet.
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
Laakkus wrote:
AlanOfTheBerg wrote:Updated OP with LiveMap to Papyrus code. Bookmarklet drag-n-drop file has not been updated yet.
I bow before your superior coding skills.. didnt have a clue about openlayer-stuff. :oops:

Here are more suitable values for zooming in WORLD SERVER.
The world server LiveMap zoom levels are different? That's rather strange.
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
Timbones wrote:
AlanOfTheBerg wrote:The world server LiveMap zoom levels are different? That's rather strange.
Yeah, fraid so - I had to fiddle the Papyrus -> Livemap bookmarlet to make it work for World. Maximum zoom level is 9. Sorry, meant to mention it...
Urgly.

OP code updated to take into account the different world LiveMap zoom levels. During this testing, I noted that there appears to be an equivalent zoom level mismatch: the zoom level is HUGE between LiveMap zoom 7 and 8 and there is no equivalent to the Papyrus level 2 zoom. It works, but because of that missing zoom level, it's fugly.
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