From 481610bf8b5774255777c4b1e603f430bb24e9f8 Mon Sep 17 00:00:00 2001 From: hyang Date: Fri, 23 Aug 2013 15:53:52 -0400 Subject: [PATCH] add raw tweets in datacollection page --- public_html/assets/php/geo_mongo2json.php | 56 +++++++++++++++++++++++ public_html/datacollection.html | 4 +- 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 public_html/assets/php/geo_mongo2json.php diff --git a/public_html/assets/php/geo_mongo2json.php b/public_html/assets/php/geo_mongo2json.php new file mode 100644 index 0000000..fa6a337 --- /dev/null +++ b/public_html/assets/php/geo_mongo2json.php @@ -0,0 +1,56 @@ + $dbname; + + // select a collection (analogous to a relational database's table) + $collection = $db->libya; + + //count the number of items in this collection + echo '

The entire collection has ', $collection->count(), ' tweets'; + + // condition $query + $nullgeolat = "0.00000"; + + $query = array("geo_lat" => array('$ne' => $nullgeolat)); + + $cursor = $collection->find($query)->limit(1000); + + //count the number of items in this query + echo '; This query returns ', $cursor->count(), ' geo-tagged tweets

'; + + echo '

The 1000 samples are as follows


'; + + echo ''; + echo ' + + + + + '; + + // iterate geo info with tweets + $index = 1; + + foreach ($cursor as $document) { + echo ''; + echo ''; + $index++; + echo ''; + echo ''; + echo ''; + echo ''; + + // echo $document["tweet_id"],' ',$document["tweet_text"],' ',$document["geo_lat"],'',$document["geo_long"]; + + } + + ?> + + + + diff --git a/public_html/datacollection.html b/public_html/datacollection.html index 5021198..23accf1 100644 --- a/public_html/datacollection.html +++ b/public_html/datacollection.html @@ -48,7 +48,9 @@
- +
IndexLat Long Tweet
',$index,'',$document["geo_lat"],'',$document["geo_long"],'',$document["tweet_text"],'