Page 1 of 1

api for getting my location.

Posted: Tue Feb 11, 2014 10:09 am
by leifnei
Is there a way to get my approximate location for an external server on the internet?

I can make a script to reroute my office deskphone to my home deskphone, but I'd like to be able to determine by querying waze server, if I'm somewhere near office or home.

A margin of 50km is good enough :-)

I'm always using waze; my speedometer is deliberately lying to me, even when the OBD-readout is true.

Re: api for getting my location.

Posted: Tue Feb 11, 2014 10:23 am
by dknight212
There is no API for providing the location from Waze, though you might be able to hack something together using the share my drive feature. Alternatively, if you're on Android then something like Tasker will be able to help determine your position and notify your server in some way. I'm sure there must be alternatives on the other OSs.

Re: api for getting my location.

Posted: Tue Feb 11, 2014 12:38 pm
by dknight212
There is likely to be a delay of a few minutes due to privacy reasons, I'm sure you'd be better off with the phone itself initiating a location report to your server.

Re: api for getting my location.

Posted: Tue Feb 11, 2014 3:27 pm
by dknight212
I'm not even sure all users are provided by the live map feed.

Edit: I'll get someone who knows these things to post.

Re: api for getting my location.

Posted: Tue Feb 11, 2014 12:07 pm
by leifnei
I think I can hack something together with getting the data sent to the live map webpage:

https://www.waze.com/row-rtserver/web/G ... 2119958550

It returns a nice json, with the location of users:

{"fleet":"none",
"id":"user-477349956/b02a540ec273-45c9-9253-02334400aeb2",
"inscale":true,
"speed":25.35386477446572,
"location":{"y":55.609500000000004,"x":12.3165},
"ingroup":false,
"addon":3,
"mood":1,
"userName":"guest",
"ping":1,"magvar":0},

I just have to find my own userid; I guess I have to start making requests and store the response, and then make a drive to see if I show up in the response; there is noone in my area now.

Re: api for getting my location.

Posted: Tue Feb 11, 2014 2:56 pm
by leifnei
A delay does not matter, the phone doesn't ring that much.
I don't want to have to remember to start yet another app on my phone, then I might as well rember to press a few buttons on my home desk-phone.
Simply: If I pass through area X between 8 and 9 am, do not relay work calls to my home phone.

But the big question: is my userid in this output constant? I'm not sure, having analyzed half an hour of data while I was out driving.

Re: api for getting my location.

Posted: Tue Feb 11, 2014 4:14 pm
by Timbones
I don't think you can rely on Waze being able to provide you with useful location information.
There are other services that will be more reliable/useful.

Which OS is your phone on? Where is your script going to be running? Are you behind a firewall?

Two suggestions:
  1. Setup app like Tasker on phone to (automatically) notify your script about its location. Monitoring which Wifi network is connectect will probably enough. When you leave home (disconnect from Wifi), your mobile will tell your script at work to redirect.
  2. Have the script monitor your Work wifi network, and when it sees your mobile phone appear on it, redirect the telephone.