osmandapp / OsmAnd

OsmAnd
https://osmand.net
Other
4.73k stars 1.03k forks source link

Add waze route calculation support #5262

Open A-Shahbazi opened 6 years ago

A-Shahbazi commented 6 years ago

It would be nice to have waze online route calculation support as currently there is no open traffic data implementation available. Here's what I encountered online and thought might be helpful: https://github.com/Nimrod007/waze-api http://htmlpreview.github.io/?https://github.com/Nimrod007/waze-api/blob/master/docs.html

A-Shahbazi commented 6 years ago

I did some research and following seems to work for gathering routes from waze(the latitude and longitude of origin and destination needs to be set for each request):

curl -e https://www.waze.com/livemap "https://www.waze.com/RoutingManager/routingRequest?from=x%3A-73.82327556610107+y%3A40.7542792926831&to=x%3A-73.96768569946289+y%3A40.647824541622086&at=0&returnJSON=true&returnGeometries=true&returnInstructions=true&timeout=60000&nPaths=3&clientVersion=4.0.0&options=AVOID_TRAILS%3At%2CALLOW_UTURNS%3At"

tazva commented 6 years ago

I support this idea, but I believe waze changed its functionality when it changed ownership, which is why the older waze stuff hasn't been used.

Would love to be wrong on this.

A-Shahbazi commented 6 years ago

@tazva I'm not sure if the first api is obsolete or not but the second solution isn't. Actually I dug up how waze livemap works yesterday and found out that the above URL simply sends back the three alternative paths in JSON format.(the referrer should be set to https://www.waze.com/livemap for that to work. As I have set the corresponding curl parameter) Take a look at the output of the terminal command I provided earlier.