Filter location issue


#1

Hi,

I am using the Streaming API lately, trying to filter tweets based on location.

Using these coordinates: locations=[-71.06,42.22,-71.04,42.38]

The problem is that I am still receiving tweets from different locations, this one for example:

“coordinates”: [
[
[
-141.5610942,
41.676329
],
[
-141.5610942,
89.9999
],
[
-51.053519,
89.9999
],
[
-51.053519,
41.676329
]
]

Not sure if I am doing something wrong here but is it possible to filter based on a city name instead of coordinates?

Thanks/
Omar


#2

Omar,

What you have shown is the correct response. It looks like you are filtering on the nested “coordinates” key within the “place” key. This matches your query as there is overlap with the coordinates of your query and the coordinates in the place key.

To ensure that the tweet is within your bounding box, you should filter on the main “coordinates” key instead of the nested “coordinates” key, making certain it is not null. You will need to do this after grabbing the tweets from the api as it is not possible to do in the query.

Also, there seems to have been a drastic change to the stream a few days ago regarding the coordinates field, where nearly 80% of tweets in stream are now marked as null in this field, this wasn’t the case before the 27th. I will be making a separate post to hopefully get some answers

Hope that helps,

Steven