Find Location where tweet came from

13,454 views
Skip to first unread message

don

unread,
Feb 10, 2010, 4:39:29 PM2/10/10
to Twitter Development Talk
Hi All,

I'm trying to determine the location where a tweet came from.

I know you can do a search specifying the location you want to look at
and this checks againist any geo data and then against the location
data. I'm guessing that twitter does a lot of error checking and
transforms the location data into a geo coord on the backend when you
do this search.

My question is: if I do a search for say a "word" and get my results
back I want to be able to check where each of the returned tweets came
from. Not just using the geo data that the user may have allowed but
also the location data (just like the search for location based tweets
does).

Essentially getting back a geo coord for each tweet if there is any
releveant geo data or location data given by the tweeter.

this site would be doing something similar: http://trendsmap.com/

any ideas? sorry if this is really obvious, I have searched and just
can't find it.

thanks
don

Raffi Krikorian

unread,
Feb 11, 2010, 11:20:08 AM2/11/10
to twitter-deve...@googlegroups.com
twitter only returns data back in its "geo" field if the tweet has been explicitly geotagged.

search, however, attempts to use other signals to determine where the tweet is, and will attempt to return "more" tweets when you use its "search" parameter.  it does not, however, expose those signals in the search results.
--
Raffi Krikorian
Twitter Platform Team
http://twitter.com/raffi

don

unread,
Feb 11, 2010, 5:17:09 PM2/11/10
to Twitter Development Talk
Thanks for the reply. Thats what I was thinking.

Would there be any way to return the location data of user with the
search results for a word?

So that I didn't need to make seperate calls for each user?

thanks so much for your help.

Raffi Krikorian

unread,
Feb 11, 2010, 10:20:55 PM2/11/10
to twitter-deve...@googlegroups.com
each user has a location field associated with it - but that is self reported.  

don

unread,
Feb 12, 2010, 1:10:52 AM2/12/10
to Twitter Development Talk
yes. I realise this is added by the user.

What I was wondering is if there is any way to have this data passed
back in the return data for a "word" search or weather I would need to
make seperate calls for each user to access it?

Eric Marcoullier @ Gnip

unread,
Feb 12, 2010, 9:59:11 AM2/12/10
to Twitter Development Talk
I apologize if this has been previously covered, but it appears that
explicit geotag info is not shown for any tweet returned via the
search API, regardless of whether a user has authorized public geo
reporting.

As a result, it is possible to determine what is being said in a
specific location, but it is not possible to determine where people
are talking about a specific subject.

I understand you not wanting to show all the signals that lead to a
geo search match, but I can't grok why you're witholding specific
metadata from the search results.

Any light you can shed would be valuable to my customers. Any plans to
change this policy would be rad.

Thanks!
Eric

(on my iPhone. Sorry for typeos)

Raffi Krikorian

unread,
Feb 12, 2010, 11:22:19 AM2/12/10
to twitter-deve...@googlegroups.com
hi eric.

just to make sure i understand what you're saying - you're saying that the geo tag (from the geotagging API) is not showing up from search?  i beg to disagree

deskdog:Desktop raffi$ curl http://search.twitter.com/search.json?q=tomcoates
{
    "results":
    [
      ...
        {
            "created_at":"Fri,
             12 Feb 2010 05:05:51 +0000",
            "from_user":"vicchi",
            "to_user_id":1292126,
            "text":"@tomcoates You did really well today. Rest. Relax. Blog. Sleep. See you tomorrow.",
            "id":8995500197,
            "from_user_id":59842,
            "to_user":"tomcoates",
            "geo":
            {
                "type":"Point",
                "coordinates":
                [
                    37.2655,
                    -121.9648
                ]
            },
            "iso_language_code":"en",
            "source":"<a href="http://www.tweetdeck.com/" rel="nofollow">TweetDeck</a>"
        },
...
    "max_id":9014080861,
    "since_id":0,
    "refresh_url":"?since_id=9014080861&q=tomcoates",
    "next_page":"?page=2&max_id=9014080861&q=tomcoates",
    "results_per_page":15,
    "page":1,
    "completed_in":0.053853,
    "query":"tomcoates"
}

seems to be working for me?

Abraham Williams

unread,
Feb 12, 2010, 11:44:11 AM2/12/10
to twitter-deve...@googlegroups.com
Don,

Twitter is intent on merging the Search and REST APIs at which point searches will return full user objects.


Abraham
--
Abraham Williams | Community Advocate | http://abrah.am
Project | Out Loud | http://outloud.labs.poseurtech.com
This email is: [ ] shareable [x] ask first [ ] private.
Sent from Seattle, WA, United States

Eric Marcoullier @ Gnip

unread,
Feb 12, 2010, 7:19:49 PM2/12/10
to Twitter Development Talk
Raffi -- you are absolutely correct. It turns out it's a frequency
thing. I've done a whole bunch of random looks at result data in the
last couple of months and I've never seen one. Now that I know what
to look for, I just grabbed a batch of 50,000 search results and found
several.

Many apologies for any work you had to do to drop some knowledge on
me :)

Eric

On Feb 12, 9:22 am, Raffi Krikorian <ra...@twitter.com> wrote:
> hi eric.
>
> just to make sure i understand what you're saying - you're saying that the
> geo tag (from the geotagging API) is not showing up from search?  i beg to
> disagree
>

> deskdog:Desktop raffi$ *curlhttp://search.twitter.com/search.json?q=tomcoates*
> {
>     "results":
>     [
>       ...
>         {
>             "profile_image_url":"http://a1.twimg.com/profile_images/523070730/twitterProfilePhoto_norm...


> ",
>             "created_at":"Fri,
>              12 Feb 2010 05:05:51 +0000",
>             "from_user":"vicchi",
>             "to_user_id":1292126,
>             "text":"@tomcoates You did really well today. Rest. Relax. Blog.
> Sleep. See you tomorrow.",
>             "id":8995500197,
>             "from_user_id":59842,
>             "to_user":"tomcoates",

>             *"geo":*
> *            {*
> *                "type":"Point",*
> *                "coordinates":*
> *                [*
> *                    37.2655,*
> *                    -121.9648*
> *                ]*
> *            },*


>             "iso_language_code":"en",
>             "source":"&lt;a href=&quot;http://www.tweetdeck.com/"

Raffi Krikorian

unread,
Feb 12, 2010, 7:48:46 PM2/12/10
to twitter-deve...@googlegroups.com
nah - no worries.  data is coming in and the rate at which geotags come in increases every day.

devjyoti patra

unread,
Feb 12, 2010, 11:26:00 PM2/12/10
to twitter-deve...@googlegroups.com
Hi,

Is there an easy way to convert these geo-codes into actual locations.
I'm using a lookup table which has been created by matching (geo-code)
-> (location specified by the user). But i was wondering if there is a
Yahoo Placemaker kind of service that developers are already using for
twitter.

Regards,
Devjyoti

Liz Crawford

unread,
Feb 15, 2010, 11:12:21 AM2/15/10
to Twitter Development Talk
I was reading this thread and I was wondering if anyone knew how to
search within a specific geolocation and then have the coordinates
(when applicable) to show up in the results. I got my program to
search within a certain area, and I was able to get the coordinates
when not looking in a specific area, but I cannot get it to do both.
Is it possible

> >http://twitter.com/raffi- Hide quoted text -
>
> - Show quoted text -

Reply all
Reply to author
Forward
0 new messages