1

I use tweepy to stream tweets filtered by location coordinates. Currently I've been streaming tweets from two different neighborhoods in a city and found out that the tweets are the same despite difference in the coordinates (they are non-overlapping areas).

Is there a resolution of the coordinates up to which the twitter API can filter the tweets?

Here's a sample code for a streamer:

(Code with sample locations)

import handler
from tweepy import Stream
from tweepy import OAuthHandler
from tweepy.streaming import StreamListener
from tweepy import API

ckey = 'blahblah..'
csecret = 'blah blah...'
atoken = 'blah blah...'
asecret = 'blah blah...'


Loc1 = [-70.981963,41.591322,-70.89941601,41.75938768]                
Loc2 = [-70.919537579,41.608616525,-70.905971579,41.617116525]      
Loc3 = [-70.92909611,41.621725545,-70.92084611,41.632153545]     


class listener(StreamListener):

    def on_status(self, status ):
        try:
            x = handler.editor('file.csv', status)        #used to save some data to file
            print x.encode("utf-8")
            return True

        except BaseException, e:
            print 'Exception:, ',str(e)

    def on_error(self, status):
        print status

auth = OAuthHandler(ckey, csecret)
auth.set_access_token(atoken, asecret)
twitterStream = Stream(auth,listener())
twitterStream.filter(locations = Loc1)

I run several instances of this code with different authorization details and locations. In this case Loc2 and Loc3 are neighborhoods in Loc1.

Luigi
  • 4,129
  • 6
  • 37
  • 57
user2963623
  • 2,267
  • 1
  • 14
  • 25
  • Could you provide some code? More specifically, what tweet data are you extracting and how are you classifying it into neighborhoods? – Luigi Apr 27 '14 at 04:16

1 Answers1

0

I think the resolution is in increments of 0.1 degree. https://dev.twitter.com/docs/api/1.1/post/statuses/filter

You will have to take all tweets of the region and filter by yourself for those that have the coordenades.

Alfonso Nishikawa
  • 1,876
  • 1
  • 17
  • 33