0

Question re: geo.placefinder and YQL

All,

We are currently working on a “locations” API where we would like to leverage the geo.placefinder data; however, I’m having a bit of trouble constructing the query that I would like to use. Perhaps someone could shed some light on the best way to achieve this:

select * from geo.placefinder where city='Clarksburg' and (countrycode='United States' or country='United States') and (statecode='West Virginia' or state='West Virginia')


It looks like the “or” clause is confusing it, since the following returns the correct record:

select * from geo.placefinder where city='Clarksburg' and (country='United States') and (state='West Virginia')


I do realize that a more restrictive UI could prevent the former query from needing to be called, but if someone has a suggestion on how I should be writing the query to check countrycode/country and statecode/state, it would be much appreciated.

Thanks,

Nathan

1 Reply
  • Follow-up: this is the response that I get from the latter query:

    CODEBOX
    <?xml version="1.0" encoding="UTF-8"?>
    <query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng"
    yahoo:count="1" yahoo:created="2010-12-13T23:21:39Z" yahoo:lang="en-US">
    <results>
    <Result>
    <quality>40</quality>
    <latitude>39.279420</latitude>
    <longitude>-80.340119</longitude>
    <offsetlat>39.279420</offsetlat>
    <offsetlon>-80.340119</offsetlon>
    <radius>6300</radius>
    <name/>
    <line1/>
    <line2>Clarksburg, WV</line2>
    <line3/>
    <line4>United States</line4>
    <house/>
    <street/>
    <xstreet/>
    <unittype/>
    <unit/>
    <postal/>
    <neighborhood/>
    <city>Clarksburg</city>
    <county>Harrison County</county>
    <state>West Virginia</state>
    <country>United States</country>
    <countrycode>US</countrycode>
    <statecode>WV</statecode>
    <countycode/>
    <uzip>26301</uzip>
    <hash/>
    <woeid>2380829</woeid>
    <woetype>7</woetype>
    </Result>
    </results>
    </query>



    Because of this, I also tried the following query:

    select * from geo.placefinder where city='Clarksburg' and (countrycode='US' or country='United States') and (statecode='WV' or state='West Virginia')

    ...only to find that it also did not return any value. Any help would be appreciated.
    0

Recent Posts

in YQL