public PhotoList < Photo > photosForLocation ( GeoData location , Set < String > extras , int perPage , int page ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; PhotoList < Photo > photos = new PhotoList < Photo > ( ) ; parameters . put ( "method" , METHOD_PHOTOS_FOR_LOCATION ) ; if ( extras . size ( ) > 0 ) { parameters . put ( "extras" , StringUtilities . join ( extras , "," ) ) ; } if ( perPage > 0 ) { parameters . put ( "per_page" , Integer . toString ( perPage ) ) ; } if ( page > 0 ) { parameters . put ( "page" , Integer . toString ( page ) ) ; } parameters . put ( "lat" , Float . toString ( location . getLatitude ( ) ) ) ; parameters . put ( "lon" , Float . toString ( location . getLongitude ( ) ) ) ; parameters . put ( "accuracy" , Integer . toString ( location . getAccuracy ( ) ) ) ; Response response = transport . get ( transport . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element photosElement = response . getPayload ( ) ; photos . setPage ( photosElement . getAttribute ( "page" ) ) ; photos . setPages ( photosElement . getAttribute ( "pages" ) ) ; photos . setPerPage ( photosElement . getAttribute ( "perpage" ) ) ; photos . setTotal ( photosElement . getAttribute ( "total" ) ) ; NodeList photoElements = photosElement . getElementsByTagName ( "photo" ) ; for ( int i = 0 ; i < photoElements . getLength ( ) ; i ++ ) { Element photoElement = ( Element ) photoElements . item ( i ) ; photos . add ( PhotoUtils . createPhoto ( photoElement ) ) ; } return photos ; }
Return a list of photos for a user at a specific latitude longitude and accuracy .