Question

I've been trying out the Yahoo YQL local search, here's my the initial query:

select * from local.search where zip='94085' and query='pizza'

It does retrieve a result like this:

<Result id="21332021" xmlns="urn:yahoo:lcl">
            <Title>Pizza Depot</Title>
            <Address>919 E Duane Ave</Address>
            <City>Sunnyvale</City>
            <State>CA</State>
            <Phone>(408) 245-7760</Phone>
            <Latitude>37.389001</Latitude>
            <Longitude>-122.003952</Longitude>
            <Rating>
                <AverageRating>3.5</AverageRating>
                <TotalRatings>6</TotalRatings>
                <TotalReviews>6</TotalReviews>
                <LastReviewDate>1307988793</LastReviewDate>
                <LastReviewIntro> Weve been coming to this Pizza Depot every week after softball games for years. The owner is very friendly and always does whatevers necessary to please the customer. Hes even stayed open late just for us after a game that didnt end until 9:45. Sometimes it gets a little busy at night, but isnt that a sign of a good pizza place? If it was always empty, then there might be something to complain about. Our group leaves satisfied week after week...</LastReviewIntro>
            </Rating>
            <Distance>0.75</Distance>
            <Url>http://local.yahoo.com/info-21332021-pizza-depot-sunnyvale</Url>
            <ClickUrl>http://local.yahoo.com/info-21332021-pizza-depot-sunnyvale</ClickUrl>
            <MapUrl>http://local.yahoo.com/info-21332021-pizza-depot-sunnyvale?viewtype=map</MapUrl>
            <BusinessUrl>http://www.pizzadepot-sunnyvale.com/</BusinessUrl>
            <BusinessClickUrl>http://www.pizzadepot-sunnyvale.com/</BusinessClickUrl>
            <Categories>
                <Category id="96926236">Restaurants</Category>
                <Category id="96926243">Pizza</Category>
            </Categories>
        </Result>

But there's no zip code. Can anyone help me include that one? Using these doesn't work either:

select zip, * from local.search where zip='94085' and query='pizza'
select zip from local.search where zip='94085' and query='pizza'

TIA

Was it helpful?

Solution

Though not an optimal solution, since the ZIP code is not an included field in the results, it would be possible to find the ZIP code by running an additional query for each of your results. In the following query, change the text to be the desired latitude and longitude.

SELECT postal FROM geo.placefinder WHERE text="37.389001, -122.003952" AND gflags="R"

To add insult to injury, YQL does not currently support table joins...at least not in the typical sense, so it's not possible to incorporate the above query into your current query.

For reference:

geo.placefinder parameters: http://developer.yahoo.com/boss/geo/docs/control-parameters.html

Joining: http://developer.yahoo.com/yql/guide/joins.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top