GeoLocation
in
Contributed Library Questions
•
2 years ago
I'm trying to run this script, but processing is telling me that the getGeoLocation() does not exist. Can anyone explain why?
- Twitter myTwitter;
- void setup() {
- myTwitter = new Twitter("user", "pass");
- try {
- twitter4j.Query query = new twitter4j.Query("revolution");
- query.setRpp(100);
- QueryResult result = myTwitter.search(query);
- ArrayList tweets = (ArrayList) result.getTweets();
- for (int i = 0; i < tweets.size(); i++) {
- Tweet t = (Tweet) tweets.get(i);
- String user = t.getFromUser();
- String msg = t.getText();
- Date d = t.getCreatedAt();
- //////////////////////////////////////////HERE/////////////////////////////////////////////////
- GeoLocation geoloc = t.getGeoLocation();
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////
- try {
- double lat = geoloc.getLatitude();
- println("latitude: " + lat);
- }
- catch (Exception e) {
- println(e.getMessage());
- println("no latitude");
- }
- try {
- double lon = geoloc.getLongitude();
- println("longitude: " + lon);
- }
- catch (Exception e) {
- println(e.getMessage());
- println("no longitude");
- }
- println("Tweet by " + user + " at " + d + ": " + msg);
- };
- }
- catch (TwitterException te) {
- println("Couldn't connect: " + te);
- };
- };
- void draw() {
- };
1