2
$\begingroup$

I currently play around with the twitter API and the option GeoLocation in Mathematica version 11.3.

However, the option GeoLocation does not work for me/it does not return anything to me.

What am I doing wrong? The normal request is:

In[19]:= twitter["TweetSearch", "Query" -> "#WolframAlpha"]

Output

If I now change it with the option

twitter["TweetSearch", "Query" -> "#WolframAlpha", "GeoLocation"]

it does not send back anything.

Thanks for any help. Regards Dan.

$\endgroup$
1
$\begingroup$

All ServiceObject requests take a request name (string) and list of parameters. In this case if you want to extract GeoLocation for a set of tweets it seems you'll have to do it like this:

tweets =
  twitter["TweetSearch",
   "Query" -> "#WolframAlpha"
   ];

twitter["GetTweet",
     "TweetID" -> #, 
    "Elements" -> "FullData"
    ]["Location"] & /@ Normal@tweets[All, "ID"]

{Missing["NotAvailable"], Missing["NotAvailable"], 
 Missing["NotAvailable"], Missing["NotAvailable"], 
 Missing["NotAvailable"], Missing["NotAvailable"], 
 Missing["NotAvailable"], Missing["NotAvailable"], 
 Missing["NotAvailable"], Missing["NotAvailable"], 
 Missing["NotAvailable"]}

It seems to me that this parameter is of minimal use in general though. I've never seen anything except Missing. Also I would have imagined they'd have implemented this in batched form via this request but I guess not.

If you instead want to add a location parameter to your tweet search you can do it like so:

loc = FindGeoLocation["255 Elm St, Somerville, MA 02144"];
twitter["TweetSearch",
  "Query" -> "",
  GeoLocation ->loc
 ]

blah

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.