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:
This can work for a Twitter user name e.g. KewGIS, as above, or a search term such as a hash tag like #KewHarapan:
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.
Experimental twitter map
- Justin and Steve -
- around the world
- the UK
- at risk
- ground breaking
- needs help
- english heritage
- Kew overseas
- verge of extinction
- wet tropics
- gifts that help
- South East Asia
- of use
- hot spot
- english garden
Keep up to date with events and news from Kew