The Wayback Machine - https://web.archive.org/web/20131018123623/https://dev.twitter.com/discussions/6797

Streaming API ignoring bounding box

wtfgecko
@wtfgecko Christopher Beale

I am having an issue with the streaming API where it is returning me tweets outside of the bounding box.

It can be seen from this map of tweet locations, the dotted box is the boundary I passed to the API, but as you can see tweets have been captured from states that overlap this bounding box.

http://i.imgur.com/Mh4LF.jpg

HOWEVER, tweets are not being returned for populous areas outside of the bounding box, but then within the states. This screenshot shows Philadelphia, which is devoid of tweets in the down-town area.

http://i.imgur.com/llFJv.jpg

Can anyone shed some light on why I am seeing this behaviour?

This is the exact URL I am capturing on the stream

https://stream.twitter.com/1/statuses/filter.json?locations=-074.891204,40.176632,-072.593505,41.112674

1 year 29 weeks ago

Replies

kurrik
@kurrik Arne Roomann-Kurrik

Thanks, I've reported Streaming results returned outside of specified bounding box

1 year 29 weeks ago
DivideByAwesome

Is there any word on this? I am noticing it as well.

1 year 28 weeks ago
ledbettj
@ledbettj John Ledbetter

This is pretty noticeable. I have a bounding box consisting of a 1 KM offset from a given point. When I get tweets back, they're almost never actually inside this bounding box. Some are up to 500 KM away from the original point.

1 year 19 weeks ago
me_bx
@me_bx Mehdi El Fadil

Hello, any progress on the resolution of the issue? It is quite blocking for some applications, as it seems that in addition of results outside of the box being returned, some results inside it do not show up...

Thanks

1 year 12 weeks ago
hurrayjobs
@hurrayjobs rajdeoksd

how to get bound box of location like New Delhi

1 year 8 weeks ago
Jacobus_XIII
@Jacobus_XIII Jacob Bijsterbosch

I'm facing the same problems.... Any progress on this? Is there a work-around?

36 weeks 2 days ago
czhae
@czhae Jay Chae

I am facing the same problem

34 weeks 2 days ago
BoneRudy
@BoneRudy Rudy Bonefas

I see that this problem was reported almost a year ago and yet I am still getting tweets outside of the locations bounding box as of today. Whats going on ?

34 weeks 1 day ago
czhae
@czhae Jay Chae

Some observations.

I set my boundary to the campus of UIUC(Champaign, IL). Although I get markers out of bound,
they are never outside of Illinois(excluding St.Louis).

http://imgur.com/j1InFru

I haven't tried it yet but I think the most basic workaround is filtering tweets with this library(if tweets are used in the front end).
https://github.com/tparkin/Google-Maps-Point-in-Polygon

34 weeks 1 day ago
ErikCaulder
@ErikCaulder Erik Caulder

Bounding box around Tampa, Florida gives me Tweets from all over Florida. Very annoying.

32 weeks 5 days ago
msasidhar
@msasidhar sasidhar

Can anybody pls help me how to use streaming API to get Tweets with geolocations(lat longs) in any given bounding area..

25 weeks 3 days ago
blackfireball5
@blackfireball5 Jon Dagata

I'm having this same issue.

Trying to get my android app to give me tweets from an area. It's for a class. If anyone could help i would appreciate it. :/

25 weeks 2 days ago
1uk
@1uk chris riley

Ditto, please help. I have been playing with this for a while and the results are far from impressive. If anyone finds anything please let me know :)

24 weeks 21 hours ago
sylvestrends
@sylvestrends Sylvestr Trends

I usually implement my own filter when consuming the streaming data if I want precise bounding box limits.

24 weeks 20 hours ago
blackfireball5
@blackfireball5 Jon Dagata

@sylvestrends Can you offer any links to examples, tutorials, or personal code examples that could assist in getting these bounding boxes to work correctly? I notice that i am in fact getting all the tweets from a certain area, but additionally i'm also getting tweets from outside the box. Assuming i could just do a second filter over the results of the first, i could get rid of anything outside of my box manually. I just have no understanding of how to go about this. Thanks.

23 weeks 3 days ago
sylvestrends
@sylvestrends Sylvestr Trends

The main thing you want to do is extract the geo origin of the incoming tweet, then do a point-in-rectangle test of that tweet's point and the target area's bounding rectangle.

Here's the python code I use once I extract the tweet's location as (long,lat) point:

  1. def point_in_bbox(point, bbox):
  2.     return point[0] >= bbox[0] and point[0] <= bbox[2] and \
  3.         point[1] >= bbox[1] and point[1] <= bbox[3]

bbox is a list containing [long, lat, long, lat] where SW corner is first, NE corner is second, if I recall correctly =)

23 weeks 3 days ago
blackfireball5
@blackfireball5 Jon Dagata

@sylvestrends Thank you, that is very helpful. I'll give this a shot and see if i can construct this in Java and get it to actually work. :)

I'm just also hoping that i am not losing tweets that are actually being returned within my box. If that is the case, this second filtering would be pointless. The only way i can really test this though is to tweet from within my box myself, and so far, every test i do myself is returned. Hoping this works, thanks again for your help!

23 weeks 3 days ago
sylvestrends
@sylvestrends Sylvestr Trends

Good luck with your efforts!

Pythonistas can use my Twitter-Streamer utility (https://github.com/inactivist/twitter-streamer#location-based-searching) to test the streaming API's bounding box search functions from the command line.

23 weeks 3 days ago
nepjua
@nepjua Yasin Uslu

Any news on this issue ?

5 days 21 hours ago