Twitter API + Google maps API to Geocode

8 Apr

I had to distribute random tweets to a sphere. I used Twitter API for loading tweets. In this case I couldn’t search including geocode be cause I couldn’t make the search in some particular place. You only got geo tagged tweets if you set Twitter API search parameter geocode to some location and radius to search with in. This did not suit for me in this project because I did not want to pic random places to find tweets I got too few results that way. Also searching with geocode twitter was found to be a slow responder.

Solution: Most of the returned tweets you had some human readable location to work with “Helsinki Finland” etc. I sent this information to Google Maps API and got geocode in return. So combining Twitter with Google Maps I got the result I was looking for.

Check the project ->  http://www.vaisala.com/seasonsgreetings/

2 Responses to “Twitter API + Google maps API to Geocode”

  1. User1111 29/10/2010 at 06:35 #

    Hi,

    I saw this post and noticed that you were successful in grabbing the location information via Twitter and send that information to Google maps. I am actually using the SWX platform with Flash to use Twitter, but am completely unable to get location information as it returns undefined. Geo information returns as null in searches. How were you able to get the location information to return as readable locations?

    • joonaskallioinen 29/10/2010 at 08:27 #

      Hi there,

      This was a long time ago but if I remember correctly you have to add parameter “geocode” to the search. Otherwise you won’t get any location information.
      I made a list of all capital cities and made a search with a random city with 800 km radius. This way I was been able to get tweets with locations. And location info like “Helsinki, Finland” I sent to google maps API and got lat and long on return.

      var geocode:String=ret.lat+”,”+ret.long+”,800km”;
      var urli:String=”http://search.twitter.com/search.json?phrase=”+(param)+”&rpp=5&geocode=”+geocode;

      I hope you will get it working :)

      BR, Joonas

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.