How to get tweets that contain geolocation information - twitter

Do you know if there is a way to get only tweets (using search/tweets api) that contains geolocation information?
I want to do a search, 100 tweets, and show in a map all of them. But, in most of my search, there is no more than 1 tweet with geolocation added.
When I say "geolocation" I'm talking about the "coordinates" tweet attribute, because "geo" is deprecated.
Thanks, Noel.

Related

How to get the old timeline or tweet?

i'm University students of South korea
I'm developing analysis application using bigdata of twitter with my advisor professor. So i'm gathering tweets contains specific keyword(relevant word of crime) at period. I use 'streaming api' and 'search api' now. I have seen that using search api and streaming api result is return tweets of only one week.
I should be get the old data that have keyword of crime and since 2006 until 2016
do you have any idea?
Sadly you can't get tweets from that time range.
From the documentation:
The Search API is not complete index of all Tweets, but instead an index of recent Tweets. At the moment that index includes between 6-9 days of Tweets.
So, you can only get recent tweets from the search API. Be careful too with the data beacuse it's about relevance not completeness, from the same documentation:
Before getting involved, it’s important to know that the Search API is focused on relevance and not completeness. This means that some Tweets and users may be missing from search results. If you want to match for completeness you should consider using a Streaming API instead.
If you really need older tweets you will have to get them from other sources like Gnip. Otherwise you will have to approach differently your problem.
If you have the names (or id's) of all the users that you want to get info you could get the timelines from each user getting up to 3200 tweets.

Twitter API location of tweets

I'm thinking up a new website idea which would allow a visitor to view on a map where certain things have happened. I want to use Twitter, with the idea that someone tweets using a specific hashtag. I want to capture that tweet using the API and find the location of where the tweet came from. Is this possible?
It is possible. However there are lots of tweets (a majority in reality) which do not get any location and it is impossible to get it for these ones. To be located, a user must enable location in its account parameters and give its location with the tweet while posting it but a majority of tweeps do not do that.
For retrieving tweets location, you just have to download the tweet with the corresponding Twitter API endpoint (GET statuses/show/:id). Once you get the tweet, search its "coordinates" field. This field has got a subfield also called "coordinates". This subfield is a list with two numbers : [longitude, latitude]. For further information, refer to the Twitter Developers documentation about tweets and coordinates.

Getting a Foursquare's tweet geoLocation

What would be the easiest way to extract the Lat and Long fields of a 'check-in' location being tweeted? When viewing tweets through a client and "expanding" them the location is shown even though the tweet does not always contain the geoLocation properties. I would like to achieve the same result (Is a Foursquare API account needed for that?)
I am using Twitter4j by the way.
Thanks for the help,
Boris
If the information is not in the geoLocation property, you will need to call the foursquare API (https://developer.foursquare.com) to retrieve the lat/lng for the venue the user checked in to. You may want to look at similar questions that have been asked in the past for more details, like: How can I get the position (lat, lon) of a foursquare checkin posted on twitter?

How to get twitter timeline of specific area using twitter api?

I want to get twitter timeline in specific area like Korea or Japan. etc.
Is there twitter api for this work?
thanks.
The closest solution to what you're looking for is using the place operator in the search API.
You will first need to lookup the location's place id, then provide it within the search query.
https://dev.twitter.com/docs/using-search
https://dev.twitter.com/docs/places/finding-tweets-about-places

find tweet location

I'm using the Twitter search api to search for a keyword so I can grab all the tweets containing that keyword. I also need to find the location of these tweets. Is this possible? I've looked through the JSON and the 'Geo' property is always null - i'd be happy to just use the location that the user has filled out in their profile but I can't see that this is available through the search api.
I've seen lots of apps that allow you to find tweets nearby based on your location but I want to do something different. find tweets by keyword and then find their location.
Is this possible?
Apologies, just found a solution.
The REST api allows me to query based on a search string:
http://search.twitter.com/search.json?&q=twitter
and this returns some json including the user id and then from there I can query again using this:
http://api.twitter.com/1/users/show.xml?user_id=1401881
which returns me user info including a location.

Resources