Posted on November 14, 2010.
I’ve been using a simple python script for awhile to track my cellphone’s location. It relies on Google Latitude for the location details. The script pulls down your geo-coordinates and then uses reverse address lookup to get the nearby street address. Both the coordinates and the address are logged to a file with the timestamp.
This script is best run as a cronjob every 10 minutes or so.
I’ve been letting this run in the background for awhile now, and it has recently saved me. I couldn’t find my phone one Sunday morning after a night out. Before I began the embarrassing task of calling the places I had been the night before, I checked my logs. Sure enough, it was reporting a street address adjacent to my apartment building. After doing a deeper search around my apartment, I found it had been kicked under the bed.
Technology saved by more technology!
Setup
-
Clone the git repo,
git clone https://github.com/jbeluch/google-latitude-location-logger.git
or simply download the raw file. -
Sign up for Google Latitude* and enable** location sharing. Note the
user
query string parameter, this is your private user id. -
Edit the script file and make 2 changes:
- Change the
GOOGLE_URL
variable, replacing<USERID>
with your user id. - Change the
LOG_NAME1
variable to be a valid path for a log file.
- Change the
-
Add an entry to your crontab for the script.
* Latitude uses a combination of GPS and cellular triangulation in order to conserve battery. This means the location is not always precise.
** You must enable location sharing for the script to access your coordinates. This means anyone with your user id can see your location. Sign up for a throwaway account like I did if this bothers you.