Embed Iran Tweet Google Maps Mashup in your website
Here's the code which you can embed in your webpage to see tweets related to ongoing Iran Election protests from Iran, Eurpoe and United States.
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://www.mibazaar.com/irantweets.html"></iframe><br /><small><a href="http://www.mibazaar.com/irantweets.html" style="color:#0000FF;text-align:left">View Larger Map</a></small>
6 Comments:
Hi, just wondering how you are able to get the location of the tweet? I want to display tweets on a map but I don't know how to get the long. and lat. of a tweet.
William! Twitter returns the location and that location information is fed into Google's Geocoding API which in turn returns Latitude and Longitude. You might want to first check out: http://apiwiki.twitter.com/
Regards,
Virender
$curl = curl_init();
// $fp = fopen("somefile.txt", "w");
curl_setopt ($curl, CURLOPT_URL, "http://search.twitter.com/search.atom?q=Japan");
curl_setopt($curl, CURLOPT_FILE, $fp);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec ($curl);
$xml = new SimpleXMLElement($result);
foreach ($xml-*entry AS $resultset) {
echo "*p*$resultset-*title (*a href='".$resultset-*author-*uri."'*".$resultset-*author-*name."*/a*)*/p*";
}
// fwrite($fp, $result);
// fclose($fp);
Thanks,
William
For query like that your url should be like this:
http://search.twitter.com/search.atom?q=japan&geocode=40.757929%2C-73.985506%2C25km
i have tried max radius till 1500 miles. but you have got to provide the geocode parameter in order for the twitter search to return locations. In the above case it returns all queries as it relates to "Japan" within 25km of New York City. instead of km you can also use mi for miles
Would be great if the annoying ad wasn't there obscuring the Tweets. Plus, it defaults to a view on Palestine instead of Iran before the first Tweet loads.
No problems. Will change the default map view and will take care of the ad interference.
thanks,
Virender
Post a Comment
<< Home