Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yahoo Weather Query by Latitude and Longitude

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 weather.forecast where woeid in (SELECT woeid FROM geo.placefinder WHERE text="{lat},{lon}" and gflags="R")

is this query is changed to new one or something? or it didn't exist anymore? last time I use this format was about 2 months ago and it worked well. but now it can't fetch any data. result from YQL console is as below:

{
 "error": {
  "lang": "en-US",
  "description": "Tenant 'query_yahooapis_com' access to 'Resource [tenantName=query_yahooapis_com, type=TABLE, name=geo.placefinder, locatorType=FILE, url=/home/y/share/manhattan/application/tenantBundles/yql_query_yahooapis_com_manhattan_v2/YQL-INF/restdefs/geo.placefinder.xml, useUrl=false]' is denied."
 }
}

I already make some research, including this post: How to get Yahoo's woeid by location?

Is that true that yahoo already terminate this latitude longitude query for fetching weather?

like image 690
squall leonhart Avatar asked Feb 05 '16 09:02

squall leonhart


2 Answers

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)")
like image 54
greg Avatar answered Jan 04 '23 11:01

greg


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());
like image 43
Vladyslav Ulianytskyi Avatar answered Jan 04 '23 13:01

Vladyslav Ulianytskyi