public void showActivityBB( String city, double v1x, double v1y, double v3x, double v3y, Calendar start, Calendar end, String output_file) throws IOException { PrintWriter out = new PrintWriter(new FileWriter(new File(output_file))); PhotosInterface pi = f.getPhotosInterface(); SearchParameters params = new SearchParameters(); params.setMinTakenDate(start.getTime()); params.setMaxTakenDate(end.getTime()); System.out.println(String.valueOf(v1x)); params.setBBox( String.valueOf(v1x), String.valueOf(v1y), String.valueOf(v3x), String.valueOf(v3y)); params.setHasGeo(true); int counter = 0; PhotoList list = null; try { list = pi.search(params, picXpage, 1); } catch (FlickrException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (SAXException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println( "\nRetrievind data around of " + city + "from " + "" + start.getTime() + " to " + end.getTime()); System.out.println(list.getTotal() + " pictures being retrieved..."); for (int k = 1; k <= list.getPages(); k++) { try { list = pi.search(params, picXpage, k); } catch (FlickrException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (SAXException e) { // TODO Auto-generated catch block e.printStackTrace(); } for (int i = 0; i < list.getPerPage(); i++) { Photo x = (Photo) list.get(i); String description, title = ""; try { x = pi.getInfo(x.getId(), x.getSecret()); } catch (SAXException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (FlickrException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } // String description=x.getDescription().replace('\n', ' '); // String title=x.getTitle().replace('\n', ' '); String date = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM, Locale.ITALY) .format(x.getDateTaken()); GeoData geo = x.getGeoData(); String username = x.getOwner().getUsername(); description = (x.getDescription()); if (description != null) description = description.replace('\n', ' '); title = (x.getTitle()); if (title != null) title = title.replace('\n', ' '); if (geo != null) { // out.println(username+"*"+geo.getLatitude()+"*"+geo.getLongitude()+"*"+geo.getAccuracy()+"*"+date); if (description != null) try { // Convert from Unicode to UTF-8 // String string = "abc\u5639\u563b"; byte[] utf8 = description.getBytes("UTF-8"); // Convert from UTF-8 to Unicode description = new String(utf8, "UTF-8"); System.out.println(description); } catch (UnsupportedEncodingException e) { System.out.println(e); } out.println( username + "\t" + title + "\t" + description + "\t" + geo.getLatitude() + "\t" + geo.getLongitude() + "\t" + geo.getAccuracy() + "\t" + date); counter++; } else { try { Iterator<Exif> iter = pi.getExif(x.getId(), x.getSecret()).iterator(); while (iter.hasNext()) { Exif exif = iter.next(); String raw = exif.getLabel() + " " + exif.getRaw(); if (raw.contains("atitude") || raw.contains("ongitude")) // avoid 1st letter for case sensitive System.out.println("!!! " + exif.getLabel() + " " + exif.getRaw()); } } catch (Exception e) { } System.out.println("broken picture @ page= " + k + " pic= " + i); } } System.out.println( (100 * k) / list.getPages() + "% Complete. Pictures " + counter + " on " + list.getTotal()); } out.close(); }