Yahoo Weather Query by Latitude and Longitude

前端 未结 2 1647
迷失自我
迷失自我 2021-02-02 02:34

I want to fetch some weather data via latitude and longitude using yahoo query. but it seems this query is not available now. the query is below:

select * from w         


        
相关标签:
2条回答
  • 2021-02-02 02:44

    This works for me(you should switch to the table geo.places(1)):

    ...

    query = "SELECT * FROM weather.forecast " +
                "WHERE woeid in (" +
                "SELECT woeid " +
                "FROM geo.places(1) " +
                "WHERE text=\"(%1$s,  %2$s)\") " +
                "AND u='c'";
    

    ... and then:

    query = String.format(query, location.getLatitude(), location.getLongitude());
    
    0 讨论(0)
  • 2021-02-02 02:58

    According to the latest reply to this answer, you should switch to the table geo.places and remove the gflags="R" part. I tried it in the YQL console and it seems to work:

    select * from weather.forecast where woeid in (SELECT woeid FROM geo.places WHERE text="(latitude,longitude)")
    
    0 讨论(0)
提交回复
热议问题