Search four fields in YQL geo.places

280 views Asked by At

We are currently using YQL to query geo data for towns and counties in the UK. At the moment, we can use the following query to find all towns named Boston:

select * from geo.places where text="boston" and placeTypeName="Town"

Demo

The issue is, that we would like to specify the county and country to generate more specific results. I have tried the following query, but it returns 0 results:

select * from geo.places where (text="boston" and placeTypeName="Town") and (text="lincolnshire" and placeTypeName="County")

Demo

How can I query 3 field types to return the results I need? Essentially, we would like to query the following fields:

text and placeTypeName="Town"
text and placeTypeName="County"
text and placeTypeName="Country"

1

There are 1 answers

0
Bob On

This may be an option maybe: https://developer.yahoo.com/blogs/ydnsevenblog/solving-location-based-services-needs-yahoo-other-technology-7952.html

As it mentions: Turning text into a location You can also turn a text (name) into a location using the following code:

yqlgeo.get('paris,fr',function(o){

alert(o.place.name+' ('+
o.place.centroid.latitude+','+
o.place.centroid.longitude+
')');

})

This wrapper call uses our Placemaker Service under the hood and automatically disambiguates for you. This means that Paris is Paris, France, and not Paris Hilton; London is London, England, and not Jack London.