Replacement for google latitude public badge

I have tried out a bunch of different apps to replace Google Latitude and nothing met the simple requirement I was trying to achieve – publish my current location on a public website. I suspect the lack of this feature in many mobile apps was due to people’s privacy concerns. I spent a few hours hacking together a solution this week.

The solution consists of three components:

  1. GPS Logger for Android  -
  2. A WordPress plugin/widget called google maps widget 
  3. Some minor coding skills

GPS logger for Android has the ability to upload your current coordinates via FTP to a server. It has the basic features you’d expect – being able to start at boot, scheduling when to upload, defining characteristics like distance as a trigger to upload, various GPS file formats (including clear text), etc.

The WordPress plugin, out of the box, loads coordinates from the Widget configuration only, but with some simple PHP changes using the file_get_contents function, it’s possible to read the latitude/longitude from a text file uploaded by the phone.

One thing I’d point out is that the FTP transfer can be unreliable over a mobile network – and it often initiates an upload, but doesn’t complete. Depending on how you set this up, that can mean your location may not display properly on a map if no coordinates are found (e.g: 0 byte file). As a work around, a little shell code crontab’ed can make sure contents get copied over to a “source of truth” file read by PHP/Wordpress only when the file is a non-zero size.

The code I used to do that is below:

if [ -s $FILE ] ; then
tail -1 $FILE | awk -F, -v OFS=’,’ {‘print $2,$3′} > /var/www/gpslogger.txt
echo “not copying gps.”

You can see an example of this “google latitude public badge” replacement working on the right side bar of this site!


3 Responses to “Replacement for google latitude public badge”
  1. Artur

    Why don’t you try Public location badge?

    • mayberry0404

      Maybe you can write a post about what it does ;) The webpage you linked is pretty bare

  2. Matt

    I’ve tried public badge referred to above… works just as well as Google Latitude did, the only thing it is missing is the “only show location accurate to the nearest town” feature, but I don’t really mind that it doesn’t have that, because the rest of it works well

Leave a Reply

seven − 2 =