问题描述
我希望在iOS中的搜索字段中输入城市名称时获取城市图像。我正在使用flickr API,但每当我输入任何经度和纬度值时,我只返回一个空数组。我该怎么办。我正在使用此网址:
I want to get images of cities when city name is entered in search field in iOS. I am using flickr API but whenever I enter any longitude and latitude values, I only get returned an empty array. What should I do. I am using this URL:
请告诉我该怎么办。任何帮助赞赏
Please tell me what should I do. any help appreciated
推荐答案
我怀疑你在lat-long上寻找太精确的匹配。使用指定不太精确的匹配。 (默认值16指定非常精确的匹配。)Flickr建议值为11以匹配城市级别,因此添加
I suspect that you are seeking too precise a match on your lat-long. Use the &accuracy
parameter to specify a less precise match. (The default value of 16 specifies a very precise match.) Flickr suggests a value of 11 to match at the city level, so add
&accuracy=11
到您的网址。
更新
我没有运气用flickr.photos.geo.photosForLocation检索图片,但我检索了图片通过lat-long与。请注意文档中的这条评论:
I have not had any luck retrieving images with flickr.photos.geo.photosForLocation, but I have retrieved images by lat-long with flickr.photos.search. Note this comment in the documentation:
例如,标签被视为限制代理,因为user
定义了min_date_taken和min_date_upload参数 - 如果没有限制
因子通过,我们只返回过去12小时内添加的照片
(尽管我们可能会在未来扩展限制)。
A tag, for instance, is considered a limiting agent as are user defined min_date_taken and min_date_upload parameters — If no limiting factor is passed we return only photos added in the last 12 hours (though we may extend the limit in the future).
还要记住西半球的经度被指定为负数。
Also remember that longitudes of places in the Western Hemisphere are specified as negative numbers.
这篇关于用于基于位置的图像的Flickr API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!