我想写一个脚本,只返回一个人的村庄,城镇或城市。我正在使用以下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只返回我想要的结果。