I’ve started using twitter as a very easy way to update this site, and since it integrates well with my iPhone I wanted to show off another cool feature. [Twitterific](http://iconfactory.com/software/twitterrific) Provides a feature to change your twitter location to that of your iphone. From this base, it becomes very easy to add a map showing your location.
- iPhone with twitterific
- Twitter Account
- Google Maps API Key ([free here](http://code.google.com/apis/maps/signup.html))
See the Full Script
$status = simplexml_load_file(“http://twitter.com/statuses/user_timeline/[userid].xml”);
where [userid] is your twitter userid.
This Line downloads and parses your recent tweets. The xml format serialized by twitter also includes your current location
$loc = str_replace(“iPhone: “,””,$status->status->user->location);
This line extracts the location coordinates from the twitter response.
$map = “http://maps.google.com/staticmap?center=”.$loc.
where [key] is your google maps api key.
This is where you can fiddle around with the map to display. Google has an interactive [wizard](http://gmaps-samples.googlecode.com/svn/trunk/simplewizard/makestaticmap.html) to let you configure your options.
this line saves the map locally, so you can serve it from your own server and keep it cached. Additionally you can add overlays or manipulate the image before saving.
Some examples of what’s possible: