Get geo location in search api


#1

Can we get geo location (lat/long coordinate) using GET search/tweets in Rest API v1.1?
I have read its documentation (https://dev.twitter.com/docs/api/1.1/get/search/tweets) and in result JSON it has on filed names geo and coordinates but having null values.

Snippet from resulting JSON :

{
“coordinates”: null,
“favorited”: false,
“truncated”: false,
“created_at”: “Fri Sep 21 23:40:54 +0000 2012”,
“id_str”: “249292149810667520”,
“entities”: {
“urls”: [

    ],
    "hashtags": [
      {
        "text": "FreeBandNames",
        "indices": [
          20,
          34
        ]
      }
    ],
    "user_mentions": [

    ]
  },
  "in_reply_to_user_id_str": null,
  "contributors": null,
  "text": "Thee Namaste Nerdz. #FreeBandNames",
  "metadata": {
    "iso_language_code": "pl",
    "result_type": "recent"
  },
  "retweet_count": 0,
  "in_reply_to_status_id_str": null,
  "id": 249292149810667520,
  "geo": null,
  "retweeted": false,
  "in_reply_to_user_id": null,
  "place": null,
  "user": {

Thanks
Abhishek

#2

“coordinates” and “place” are the attributes you’ll most be interested in – take a look at [node:7286, label=“the field guide for tweets”].

Tweets only contain geolocation data when the user has both opted their account in to geotagged tweets and has explicitly added gelocation data to their tweet.


#3

So we get coordinates only if user enable geotagging in his tweets.
Is there no other way around?


#4

Nope. The user is in full control and it’s completely their choice as to how much or how little information they want to share about their location.


#5

Is there a way to only get tweets that have coordinates?


#6

statuses/filter used with the locations parameter will get only tweets that have coordinates