How to get location of Tweets with search API?

@mattfordham Matt Fordham

The 'statuses/user_timeline' part of the API returns geolocation data as "place" along with each Tweet. The search API, on the other hand, does not return this location data (as far as I can tell). Is there a way to get location data with the search API?

2 years 21 weeks ago


@kurrik Arne Roomann-Kurrik

Unfortunately the search API is fairly different from the rest of the REST APIs. We are working on getting them unified, but you'll need to treat the responses differently.

Some search API responses will contain a populated "geo" object:

  1.       "geo": {
  2.         "coordinates": [
  3.           40.6455,
  4.           -73.7757
  5.         ],
  6.         "type": "Point"
  7.       },

Others will contain a "location", pulled from the user's profile location info. Sometimes this has coordinates:

"location": "iPhone: 40.643913,-73.749466",

but other times it may be arbitrary:

"location": "YYZ - JFK",

If you want to limit search results to those with either of these, use the geocode parameter and set the radius to encompass the Earth.

2 years 21 weeks ago
@mattfordham Matt Fordham

Hmm. I posted a test tweet using the Twitter website's location feature then searched for it. "Geo" is empty:

On the other hand, the same Tweet on 'user_timeline' includes "place":

2 years 21 weeks ago
@jgoolam Joe Goolam

If we just using the search API, we see geo field but never the actual location. Is it not true that this is only available in the stream APIs.

2 years 4 weeks ago
@imminentedema Supraja

don't all tweets have a location attached ? I get null to some getLocation() queries.

1 year 1 week ago
@oyonas yoonas

but is it permitted to harvest geo location data, on another thread on this forum i read that is is against the terms of twitter... ,

50 weeks 5 days ago
@oyonas yoonas , pls look at here and tell us if its okay

50 weeks 5 days ago
@jamilshah20 jamil shah

plz tell that how i will location of a tweet of a sender

19 weeks 3 days ago