twitter4j geo streaming latitude/longitude for Hongkong

做~自己de王妃 提交于 2020-01-11 13:41:47

问题


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:


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}
}


来源:https://stackoverflow.com/questions/30886007/twitter4j-geo-streaming-latitude-longitude-for-hongkong

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!