A few months back I wrote a quick post about tweeting from the command line. With the recent announcement that Twitter’s location feature is starting to go live, I decided to revisit this idea, with an eye toward adding locational information.
(I am, at heart, a cheapskate – I could have bought one of the existing Twitter clients that support locational Tweets but I really just want to play around with this new feature for now. The command line is free, baby!)
Twitter’s API methods now support adding geographic coordinates with a status update. Sending out a GeoTweet using the command line is easy (note, this example assumes you know the lat/long of the location you want to associate with your Tweet).
Open up your favorite editor and drop the following into it:
curl -s -u user:password -d status="$1" -d lat="$2" -d long="$3" http://twitter.com/statuses/update.xml > /dev/null
Save the file and make sure it is executable (chmod u+x fileName). You can execute this file at the command line like this:
$ ./fileName "Testing twitter geolocation feature" "+39.754571" "-75.571985"
When you examine the properties of this tweet, you will see that it now has geographic information associated with it:
<geo xmlns:georss="http://www.georss.org/georss">
<georss :point>39.754571 -75.571985</georss>
</geo>
How cool is that!
As more Twitter applications (and the Twitter website itself) roll out support for this new feature, a host of new Gov 2.0 potential is going to be unlocked. I think this will have huge implications for services like 311, where location is critical to service requests.
Municipalities like New York City and San Francisco that have already incorporated Twitter into their 311 service will have a big head start in this regard.
Leave a Reply