【问题标题】:twitter4j geo streaming latitude/longitude for Singapore and beyond新加坡及其他地区的 twitter4j 地理流经纬度
【发布时间】:2016-11-07 21:10:08
【问题描述】:

虽然它可能看起来与twitter4j geo streaming latitude/longitude for Hongkong 的问题相同,但事实并非如此。

我已经修改了 twitter4j 的流式示例代码并生成了这个:https://www.dropbox.com/s/gj75fghtqy5jajf/tweity.zip?dl=0

可以编译:

$ javac -classpath twitter4j-core-4.0.4.jar:twitter4j-media-support-4.0.4.jar:twitter4j-async-4.0.4.jar:twitter4j-examples-4.0.4.jar:twitter4j-stream-4.0.4.jar PrintFilterLocationStream.java

然后运行:

java -cp .:twitter4j-core-4.0.4.jar:twitter4j-media-support-4.0.4.jar:twitter4j-async-4.0.4.jar:twitter4j-examples-4.0.4.jar:twitter4j-stream-4.0.4.jar PrintFilterLocationStream "{{-126.562500,30.448674},{-61.171875,44.087585}}"

如果我得到正确的边界框,它工作得非常好,请参阅Can't get location filters to work using Twitter4J

但是对于新加坡,我已经从http://isithackday.com/geoplanet-explorer/index.php?woeid=24703045 查到了位置,但不知何故它抱怨它无效。

[出]:

[Wed Jul 06 05:48:15 SGT 2016]Parameter not accepted with the role. 406:Returned by the Search API when an invalid format is specified in the request.
Returned by the Streaming API when one or more of the parameters are not suitable for the resource. The track parameter, for example, would throw this error if:
 The track keyword is too long or too short.
 The bounding box specified is invalid.
 No predicates defined for filtered resource, for example, neither track nor follow parameter defined.
 Follow userid cannot be read.
Latitude/longitude are not valid: 1.31, 103.75, 1.47, 103.87

406:Returned by the Search API when an invalid format is specified in the request.
Returned by the Streaming API when one or more of the parameters are not suitable for the resource. The track parameter, for example, would throw this error if:
 The track keyword is too long or too short.
 The bounding box specified is invalid.
 No predicates defined for filtered resource, for example, neither track nor follow parameter defined.
 Follow userid cannot be read.
Latitude/longitude are not valid: 1.31, 103.75, 1.47, 103.87

我也尝试过更大的盒子("{{1,103},{2,104}}" 新加坡),但仍然无效。

我根据http://isithackday.com/geoplanet-explorer/index.php?start=malaysia 尝试在马来西亚使用"{{0.66364, 98.935059},{7.58378, 119.448433}}",但它也无效。同样,印度尼西亚的"{{ -11.00485, 94.969833},{6.07573, 141.021805}}" 也不起作用 (http://isithackday.com/geoplanet-explorer/index.php?start=indonesia)。

  • 新加坡的纬度/经度值应该是多少?

  • 但是马来西亚或印度尼西亚呢?

  • 是否有国家/城市的边界框列表?看起来很容易成为静态列表?

【问题讨论】:

    标签: java twitter geolocation twitter4j bounding-box


    【解决方案1】:

    twitter4j 需要的坐标与http://isithackday.com/geoplanet-explorer/index.php?start=singapore 上显示的顺序相反...

    新加坡是"{{103.618248,1.1158},{104.40847, 1.47062}}"

    对于马来西亚,它是"{{98.935059,0.66364},{119.448433,7.58378}}"

    对于印度尼西亚,它是"{{94.969833,-11.00485},{141.021805,6.07573}}"

    除此之外,如果 http://isithackday.com/geoplanet-explorer/index.php 显示其他位置:

    Bounding Box:
    NE numA, numB
    SW numC, numD
    

    twitter4jFilterQuery.locations 期望:

    {{numD,numC},{numB,numA}}
    

    【讨论】:

      猜你喜欢
      • 2013-05-09
      • 1970-01-01
      • 1970-01-01
      • 2015-12-06
      • 2013-10-01
      • 1970-01-01
      • 2019-02-13
      • 2022-12-21
      相关资源
      最近更新 更多