我想寫一個腳本,只返回一個人的村莊,城鎮或城市。我正在使用以下YQL查詢,但console的結果太具體,他們首先給我鄰居。從flickr api提取城鎮/城市YQL
select * from flickr.places where lat=51.558418 and lon=-1.781985 and api_key=YOU_FLICKR_API_KEY
這是我從控制檯查詢的結果。
<?xml version="1.0" encoding="UTF-8"?>
<query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng"
yahoo:count="1" yahoo:created="2011-10-25T09:35:50Z" yahoo:lang="en-US">
<diagnostics>
<publiclyCallable>true</publiclyCallable>
<url execution-start-time="1" execution-stop-time="123" execution-time="122"><![CDATA[http://api.flickr.com/services/rest/?method=flickr.places.findByLatLon&lat=51.558418&lon=-1.781985]]></url>
<user-time>124</user-time>
<service-time>122</service-time>
<build-version>22535</build-version>
</diagnostics>
<results>
<places accuracy="16" latitude="51.558418" longitude="-1.781985" total="1">
<place latitude="51.547" longitude="-1.802"
name="West Leaze, Swindon, England, GB, United Kingdom"
place_id="sddCvK9SW703gg" place_type="neighbourhood"
place_type_id="22"
place_url="/United+Kingdom/England/Swindon/West+Leaze"
timezone="Europe/London" woeid="39722"/>
</places>
</results>
</query>
我希望能夠在查詢中更改place_type_id。我知道我可以使用正則表達式來隔離信息,但我不確定這是否適用於所有位置,所以我更願意讓API只返回我想要的結果。