Weather at Yahoo WebService

I am trying to find a way to get some weather information in Yahoo Weather using Yahoo Query Language.

Since I live in France, in a city called Nice, the following query returns an error:

select * from weather.forecast where location='Nice'

I have a latitude and longitude coordinate, so how can I give them YQL to return weather information? Is this service worldwide or only for the USA?

+3
source share
1 answer

Instead, you should use a different YQL data type. I tried this query and it works fine:

SELECT * FROM weather.bylocation WHERE location='Nice' AND unit="c"

This is the YQL console

I added unit="c"to get it in Celsius, suggesting that you want it. If not, use "f".

weather.bylocation :

  • " " (woeid) ,
  • .

. :

    <execute><![CDATA[
      default xml namespace ='http://where.yahooapis.com/v1/schema.rng'; 
      var x = y.query('select woeid from geo.places(1) where text="'+location+'"');
      var s = x.results;
      var woeid = s..woeid;
      var weather = y.rest('http://weather.yahooapis.com/forecastrss?w='+woeid+'&u='+unit).get().response;
      response.object = <weather>{weather}</weather>;
    ]]></execute>

: , , , , , ?

:

http://developer.yahoo.com/weather/

http://developer.yahoo.com/geo/geoplanet/guide/concepts.html

+4

Source: https://habr.com/ru/post/1784788/


All Articles