Question re: geo.placefinder and YQL


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.



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

    <?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">
    <line2>Clarksburg, WV</line2>
    <line4>United States</line4>
    <county>Harrison County</county>
    <state>West Virginia</state>
    <country>United States</country>

    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.

Recent Posts

in YQL