twitter4j geo streaming latitude/longitude for Hongkong

420 views Asked by At

I'm trying to capture tweets using twitter4j's streaming methods from the area of Hongkong. However not matter what latitude or longitude coordinates I choose to do so (from http://www.latlong.net/convert-address-to-lat-long.html) I always get invalid latitude/longitude error.

Latitude/longitude are not valid: 22.27, 114.17, 22.35, 114.21

The code I use is otherwise working fine:

    TwitterStream twitterStream = new TwitterStreamFactory(cb.build()).getInstance();
FilterQuery fq = new FilterQuery();
  fq.locations(
                new double[][]{
                new double[]{ 22.274286d, 114.166875d},
                new double[]{22.351943d, 114.214683d}
        });
 twitterStream.addListener(listener);
        twitterStream.filter(fq);

What am I missing? Are there any restrictions on the latitude/longitude? I already took care to have the south-west point come first in the array.

1

There are 1 answers

1
Ramanan On BEST ANSWER

The coordinates should be {southwestLon,southwestLat},{northeastLon,northeastLat}

https://dev.twitter.com/streaming/overview/request-parameters#locations

new double[][]{
                new double[]{114.166875d, 22.274286d},
                new double[]{114.214683d, 22.351943d}
}