Skip to main content

You are here

Facebook icon
Pinterest icon
Twitter icon

Mapping live data and tweets from the field

Justin Moat and Steve Bachman
14 February 2012
Blog team: 

Mapping live data and tweets from the field - experiments with the latest technology 'mashups' in Sumatra.

On our latest project in Harapan (Sumatra) we took the opportunity to experiment with feeding back live data from the field. We also wanted to continue the trend of tweeting from the field. We tried this on other trips (see Kew in Madagascar also here and Kew in Ethiopia). To take it a step further, we decided to map the tweets. You can see the map here.

Sample map from our Harapan Twitter feed

This post is a quick response to those of you who were asking how we did it. We’ll outline the process and point you in the right direction for the code, so you can have a go yourself.

To start with you need to make sure your tweets are geotagged. Geotagging is the process of adding a latitude and longitude co-ordinate to something, in this case, your tweet. To enable geotagging go to the Twitter settings page and click “Enable Geotagging”. You also need to make sure geotagging is enabled on your mobile device. Now, when you send a tweet you should see a little marker symbol, which means your tweets can be mapped. For more info see this blog post: (http://blog.twitter.com/2009/11/think-globally-tweet-locally.html)

To get the tweets to a website we need to access the twitter feed. For this we use a JSON query:

http://api.twitter.com/1/statuses/user_timeline/KewGis.json?count=100&callback=?

This can work for a Twitter user name e.g. KewGIS, as above, or a search term such as a hash tag like #KewHarapan:

http://search.twitter.com/search.json?callback=?&q=kewharapan&rpp=100

This returns formatted text of the last 100 tweets. We then filter out all tweets without geotags (using jquery to handle the data and tweet.geo is not null) and build the Google Maps markers. Finally, the tweets are formatted to html (with images and links etc.) and added to the popup window. Another view of the tweets is given below the map.

We should point out, this is experimental for us, we are not coders, but are geeky enough to hack a bit of code that works. Thanks to all those who make their code available to others. Most of the mapping code is borrowed from: Mike Williams at Google Maps API Tutorial  and updated to Google maps 3 API. Links from twitter feeds came from Jack Barber.

You can find a copy of the code used for the twitter map here.

Also, you can have a play on our experimental pages.   

Twitter map

Experimental twitter map

We are also experimenting with using Google Fusion Tables and ODK  to send live data from the field - we can tell you more about that in another post!

- Justin and Steve -

Add comment

CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
12 + 5 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.

Comments

25 July 2013
Comment: 
It looks like twitter has retire this rest API, I hope to update these maps with the new API. see https://dev.twitter.com/docs/faq#17750

Browse by blog team