Question

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:

http://api.flickr.com/services/rest/?method=flickr.photos.geo.photosForLocation&api_key=e3d577010e5979a2ad2a22714abd901e&lat=40.6700&lon=73.9400&format=json&nojsoncallback=1&auth_token=72157638668602974-e1a3a3aa1e6d3dd8&api_sig=a0233b016c863b1662aeb21a664c351a

Please tell me what should I do. any help appreciated

Was it helpful?

Solution

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

to your URL.

Update

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:

Geo queries require some sort of limiting agent in order to prevent the database from crying. This is basically like the check against "parameterless searches" for queries without a geo component.

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.

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