Search code examples
rtwittertwitter-streaming-api

Defining a location bounding box in filterStream()


I am trying to setup a location bounding box for Austin area within filterStream() .

According to the documentation, it should work with a simply defined loc() input like this:

tweets <- filterStream( file.name="", language="es",
                      locations=c(-74,40,-73,41), timeout=600, oauth=my_oauth )

But when I try to bound Austin by two lat-long combinations, it doesn't works. And, in my Json output I can see: Lat/Long not valid

The official documentation says to start with the southwest co-ordinates, but says little about how to proceed further. Also, how to define a box using just two co-ordinates?

I looked further into location bounding box and stumbled upon a different format here: http://wiki.openstreetmap.org/wiki/Bounding_Box

According to Openstreetmap the location bounding box should be defined in the following way:

bbox = left,bottom,right,top
bbox = min Longitude , min Latitude , max Longitude , max Latitude

Also, Under Twitter's official documentation, the bounding box has been defined using only two sets of lat-long combination: https://dev.twitter.com/streaming/overview/request-parameters#locations

How do I define a box using just two pairs of lat-long combinations?

Edit

Here's the code that I'm trying to run:

filterStream(file.name = 'tweets13.json',
             track = c('Austin Startup'),
             locations = c(30.166868, -98.018485, 30.436016, -97.495261),
             language = 'en',
             timeout = 360,
             oauth = my_oauth)

Solution

  • You seem to have reversed lat and lon. (There is no -98 latitude.) Wallace Stegner's excellent book "Beyond the 100th Meridian" should have been titled "Beyond the Minus 100th Meridian." Austin appears to be just to the East of where John Wesley Powell had his fame and later efforts on land use policy.