Flickr 4 Java-如何从特定区域查找图片/元数据?e、 g.维也纳
最好的 目标: 接收地理数据(坐标)、时间戳。“来自维也纳拍摄的照片。” 我的问题: 我如何在Java中做到这一点?(使用flickrapi-1.2.jar) 我已经发现了什么强> 给我500张最近的照片-url的…:Flickr 4 Java-如何从特定区域查找图片/元数据?e、 g.维也纳,java,api,flickr,Java,Api,Flickr,最好的 目标: 接收地理数据(坐标)、时间戳。“来自维也纳拍摄的照片。” 我的问题: 我如何在Java中做到这一点?(使用flickrapi-1.2.jar) 我已经发现了什么 给我500张最近的照片-url的…: public static void main(String[] args) throws FlickrException, IOException, SAXException { String apiKey = "123456789abcdefghijkl
public static void main(String[] args) throws FlickrException, IOException,
SAXException {
String apiKey = "123456789abcdefghijklmnopqrstvwuxz";
Flickr f = new Flickr(apiKey);
PhotosInterface photosInterface = f.getPhotosInterface();
Collection photosCollection = null;
photosCollection = photosInterface.getRecent(500, 0);
int i = 0;
Photo photo = null;
Iterator photoIterator = photosCollection.iterator();
while (photoIterator.hasNext()) {
i++;
photo = (Photo) photoIterator.next();
System.out.println(i + " - Description: " + photo.getSmallUrl());
}
}
选项:welkom是一个很好的示例或一本不错的手册,因为我不知道这个API是如何工作的
您需要调用API方法
使用Flickr4Java时,它将如下所示:
String apikey;
String secret;
// Create a Flickr instance with your data. No need to authenticate
Flickr flickr = new Flickr(apikey, secret, new REST());
// Set the wanted search parameters (I'm not using real variables in the example)
SearchParameters searchParameters = new SearchParameters();
searchParameters.setAccuracy(accuracyLevel);
searchParameters.setBBox(minimum_longitude,
minimum_latitude,
maximum_longitude,
maximum_latitude);
PhotoList<Photo> list = flickr.getPhotosInterface().search(searchParameters, 0, 0);
// Do something with the list
字符串apikey;
串秘密;
//使用您的数据创建Flickr实例。不需要验证
Flickr Flickr=newflickr(apikey,secret,newrest());
//设置想要的搜索参数(示例中我没有使用实变量)
SearchParameters SearchParameters=新的SearchParameters();
搜索参数。设置精度(精度等级);
searchParameters.setBox(最小经度,
最低纬度,
最大经度,
最大纬度);
PhotoList=flickr.getPhotosInterface().search(searchParameters,0,0);
//对清单做点什么