Getting a Foursquare's tweet geoLocation - twitter

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?

Related

get country and city information from wikimapia Api

I need to know in which country (and hopefully some more info, like city or area or state and it would be great if I could get whether this is on land or sea) a coordinates set lies in.
I have tried the wikimapia api but it is extremely difficult to get around to it.
for example I have this call
http://api.wikimapia.org/?function=box&key=example&bbox=23.72251,37.96918,23.73094,37.9731&format=json
which brings some information about an area in Athens, Greece.
The problem is that not only this api call is depreciated, but when i try to get the country by adding &category=2977
http://api.wikimapia.org/?function=box&key=example&bbox=23.72251,37.96918,23.73094,37.9731&format=json&category=1176
this doesnt work(the category id i got it from this gist)
I would guess that this might have something to do with the method being depreciated, but when I change to the new method place.getbyarea it is not working at all.
http://api.wikimapia.org/?function=place.getbyarea&key=example&bbox=23.72251,37.96918,23.73094,37.9731&format=json
Any ideas? thanks in advance
Why do you want specifically the API of Wikimapia to get your information? To recover the city and country from GPS coordinates, some others API’s are much more appropriate I think, here some examples:
Google Maps (used here in a webpage)
Here Maps
Bing Maps
Apple Maps (Mapkit.js)
Algolia Places
OpenStreetMap Nominatim

Tweets, Location, Keywords and Data

I'm trying do some analysis on locations where people are going during winters. The approach I'm following is get tweets from a specific city (say, New York) and with the keyword Foursquare. Then use foursquare data for that user to see his/her checkins and try to trace a pattern.
So, I'm stuck in the first phase. How do I get those tweets from ONE city and with the keyword FOURSQUARE. I'm not sure if I understood how to use streaming API correctly and the ReST API isn't working (shows NOT AUTHORISED)
Could you tell me a detailed procedure for a rookie to understand the process of doing the above mentioned process. Also, let me know if you have a better approach for analysing trends in check ins.
Thanks
You want to read these:
https://dev.twitter.com/docs/api/1/get/search
https://dev.twitter.com/docs/platform-objects/places
You can give Twitter a latitude/longitude coordinate and a radius, or you can use the "place" field as a filter. Either way, expect to fine-tune this a bit to fit your needs. You also need to take into account that a lot of people might tweet without location services enabled.
If you want to use the REST API, you need to get an API key from twitter.

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.

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