Google Local on T-Mobile

I was using Google Maps on my phone before it was cool. My little prototype Python application, Pyhole, still gets some use despite the fact that shortly after I got it working Google released their own Google Local Mobile. Why? Google’s client doesn’t work with T-Mobile. At all. Not to mention the cheap “t-zones” plan I’m on, which blocks almost all destination ports.

Well, apparently it is in fact possible to get unlimited Google Maps on T-Mobile’s $5/month “t-zones” data plan after all:

Google Local Mobile on my phone, yay

GLM doesn’t use the same protocol for talking to Google that their Javascript map browser uses. GLM is bandwidth optimized, sending tiny binary POST requests to a single URL at google, and reading back multiple PNG tiles per request. Furthermore, the URL it uses for these POST requests is configured in the midlet’s .jad file. My hack goes something like this…

  1. Use the phone’s web browser to start installing GLM. The Google server will detect the phone’s model, and point it to a particular .jad file
  2. Download a copy of the .jad, using a URL scraped from the HTTP proxy logs
  3. Replace ServerAddress: with something like ServerAddress:
  4. Set up a reverse proxy from that URL back to the original Google URL. I used Apache’s mod_rewrite and mod_proxy.

The .jad file also has some juicy-looking parameters for tuning the UI and the cache sizes. I’m still not sure how useful these are, but I’d love to use more of my phone’s 512MB flash to store map tiles.

Mobile map inspiration

So, I’ve been itching to do something really cool with Python on Symbian Series 60. The first thought was a way to upload images directly from the phone to Gallery. Well, it still needs some polishing, but I wrote most of that at the last SVLUG hackfest. Right now it takes a picture with the phone’s camera, saves it locally, then beams it off directly to a Gallery server over GPRS, via an HTTP proxy and the gallery-remote protocol. Unfortunately, the Python module for the camera doesn’t give you a lot of control. A much more practical (hah!) solution would be to have the script send everything it finds in an ‘outbox’ directory- so you just save images there with any camera app, then upload them at your convenience by running a simple script.

Anyway, while that was kinda fun to write, it wasn’t really as interesting as I’d hoped. This might just be due to the extreme suckiness of phone cameras. Yesterday I found something much cooler. For a while now I’ve been interested in getting maps on my mobile devices. Google maps, of course, seem the obvious solution. Mobile web browsers aren’t fancy enough yet to support the latest AJAX applications, but I’d want a small-screen-tweaked UI anyway.

Well, MGmaps to the rescue right? It’s a pretty spiffy app. Unfortunately, being in Java it’s kinda sluggish and not readily hackable. I’d like to have it make use of my phone’s 512MB MMC card to keep a disk cache of map tiles. Doing all the browsing over a slow GPRS link with very little cache is hardly fun or useful.

Yesterday I stumbled across a Nokia forum post with a literally 100-line Python app to browse Google Maps online. It has a lot of rough edges- drawing artifacts while it’s loading, I had to hack it a bit to support HTTP proxies, and it has a ‘cache’ which will use an unbounded amount of RAM. But, it makes a great proof-of-concept and a great inspiration. I’d love to write a similar app with better cache management, a more extensible and maintainable architecture, and better responsiveness while downloading images.

If I do go through with writing such an app, I’ll finally be using Python to bring a keyhole-like system to devices you always have handy. I shall call it “pyhole”.