Search code examples
javascriptyqlyahoo-api

Yahoo YQL query with gFlags returns nothing


Using Yahoo YQL when I try to query using gFlags nothing returns. https://developer.yahoo.com/yql/console/?debug=true#h=select+*+from+geo.placefinder+where+text%3D%2237.416275%2C-122.025092%22+and+gflags%3D'R'

Response:

<?xml version="1.0" encoding="UTF-8"?>
<query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng"
    yahoo:count="0" yahoo:created="2016-01-20T16:07:28Z" yahoo:lang="en-US">
    <diagnostics>
        <publiclyCallable>true</publiclyCallable>
        <url execution-start-time="16" execution-stop-time="21"
            execution-time="5" http-status-code="503" http-status-message="Service Unavailable"><![CDATA[http://gws2.maps.yahoo.com/findlocation?pf=1&locale=en_US&offset=15&flags=&q=37.416275%2c-122.025092&gflags=R&start=0&count=100]]></url>
        <user-time>22</user-time>
        <service-time>5</service-time>
        <build-version>0.2.376</build-version>
    </diagnostics> 
    <results/>
</query>

When I remove gFlags, there's a succesfull result. Example: https://developer.yahoo.com/yql/console/?debug=true#h=select+*+from+geo.placefinder+where+text%3D%2237.416275%2C-122.025092%22

I need to use gFlags to access the woeid attribute (from the POI, according to the docs: https://developer.yahoo.com/boss/geo/docs/free_YQL.html)


Solution

  • After much playing yesterday, I discovered that the geo.placefinder table returns nothing, but the geo.places table does. So you can change your query to "select * from geo.places(1) where..." Just be aware that the results are formatted slightly differently.

    Also, I noticed that when passing in latitude and longitude, be sure to include parentheses around it. E.g. text="(111.11111,222.22222)"

    So, to repost your original query with the working places (notice there is no more GFlags parameter and the parentheses around the lat/lng):

    https://developer.yahoo.com/yql/console/?debug=true#h=select+*+from+geo.places(1)+where+text%3D%22(37.416275%2C-122.025092)%22