How do I best construct a request to return coordinates of tweets


#1

I’ve been looking for ages with no luck. How do I construct a search query to return tweets within a specific radius of my lat long. I will need to get the coordinates of the returned tweets so that I can plot on a map
Specifically
Do I need to authenticate the request in the 1.1 api?
How do I loop through the tweets to get the coordinates?
Is there a tutorial that may help me?

Thanks


#2

Do I need to authenticate the request in the 1.1 api?
Yes

How do I loop through the tweets to get the coordinates?
Use the REST API or the Streaming API. Both API’s return collections of tweets which you can iterate through and read their coordinates if they have any.

Is there a tutorial that may help me?
Not that I know of, but there is plenty of source code that may be instructive.


#3

Thanks boxnumber03,
Appreciate the answers but as I stated in my question I need some direction rather than generalisation. Specifically with examples. As you may have gathered from my questions, I am not that well versed with the Twitter API so I’m looking for the source code by way of hyperlinks rather than conformation that there is ‘plenty out there’. Again, I have looked and not actually found anything relevant… I’m not being rude - just keen to get solid answers rather than vague pointers. Thanks


#4

Do you have a preferred programming language, or will any language do?


#5

Apologies. I should have said that I’m using objective C


#6

I have not tried doing this with objective C myself. I would probably start with this project:
https://github.com/jaanus/PlainOAuth.

I cannot point you to a complete example in objective C. It is not trivial, and, in general, it takes a lot of trial-and-error to get something working. I don’t think you are going to find a complete answer to your question without a bit of your own leg work.

Here is the direction I would take:

  1. Get oauth working with any Twitter endpoint (starting with PlainOAuth)
  2. Switch to this endpoint to get your tweets: https://api.twitter.com/1.1/search/tweets.json

If you can get that far on your own, come back here and re-ask your question. That part is fairly simple and most likely you will have answered it yourself.

(BTW, very few tweets – maybe 1% – actually have coordinates data.)


#7

That’s great advice. Thanks for that. I’ll look into it and let you know how I get on. Cheers