Just this morning I did a test to see f I could create a URL that initiates Waze in navigation mode. In Colombia only historic traffic is available in Navigator, and our client needed real time traffic info.
To make this work the coordinates need to be provided in lat lon. At the DevSummit this month there was an announcement that the JavaScript API would will include the projection engine to do client side projections, which is very cool and fast. Not sure if we will be able to take advantage of this in the update next month (April 10th).
To be able to advance and provide some solution for this client I came up with the following expression:
function MetersToLatLon(mx, my) {
var originShift = 2.0 * PI * 6378137.0 / 2.0;
var lon = (mx / originShift) * 180.0;
var lat = (my / originShift) * 180.0;
lat = 180.0 / PI * (2.0 * Atan( Exp( lat * PI / 180.0)) - PI / 2.0);
return [lat, lon];
}
function CreateWazeURL(lat, lon) {
return "https://waze.com/ul?ll=" + lat + "," + lon + "&navigate=yes"
}
var latlon = MetersToLatLon(Geometry($feature).X, Geometry($feature).Y);
var url = CreateWazeURL(latlon[0], latlon[1]);
return url;
I did some testing with a web map on my iPad and it works like a charm. This only convert the Web Mercator Auxiliary Sphere coordinates to WGS1984 decimal degrees.