Skip to content

Searches Flickr for photographs and metadata

Notifications You must be signed in to change notification settings

FrancescaMancini/photosearcher

 
 

Repository files navigation

Travis build status Codecov test coverage Project Status: Active – The project has reached a stable, usable state and is being actively developed.

photosearcher

The goal of photosearcher is to provide a repeatable methodology for accessing the Flickr API. More information can be found on the package website. For more information and examples of the functions check out the package vignette.

We have produced this package to help facilitate reproducible code for answering research questions. In the PLoS journals alone there are over 180 articles with Flickr in their keywords. Click here for an overview of the use of Flickr in PLoS journals. Articles using Flickr are published in a wide range of journals for a wide range of research fields including biology and life sciences, computer and information sciences, medicine and health sciences and politics.

Terms of use

This package should be used within accordance of the Flickr API terms of use.

Installation

You can install the released version of photosearcher from github with:

devtools::install_github("nfox29/photosearcher")

Getting an API key

The package requires a valid API key from the Flickr development page. The first time you call a function from the package, you will be prompted to create and enter your API key. The API key will then be saved as photosearcher_key.sysdata in your working directory and is used for all function.

Package functions

The package currently focuses on the ability to use the Flickr API to search for images and their metadata through the photo_search function (see the flickr.photos.search method) for more information. These photographs can be downloaded using download_images function which saves the images as a .jpeg file.

The package also allows users to find the top tags for a given location (location_tags) and the tags most commonly associated with a given tag (related_tags). The Flickr website offers full API Documentation for all of its call methods.

Searching for photo metadata

In this example, we demonstrate how to search for metadata on all images labelled with the text or keywords rock climbing between 2010 and 2019 in the UK and Ireland.

library(photosearcher)

rock_climbing <- photo_search(
  mindate_taken = "2010-01-01",
  maxdate_taken = "2018-01-01",
  text = "rock climbing",
  bbox = "-12.875977,49.210420,2.636719,59.977005",
  has_geo = TRUE
)  

When has_geo == TRUE only metadata about images with latitude and longitude information will be retrieved.

These can be plotted using other packages at user preference. In the below example, we convert these to an sf object and plot using ggplot2.

library(sf)
rock_climbing <- st_as_sf(rock_climbing, coords = c("longitude", "latitude"))

library(ggplot2)
ggplot() +
  geom_polygon(data = map_data("world", region = c("Ireland", "UK")), 
                               aes(x=long, y = lat, group = group),
                               fill = "lightgrey") + 
  geom_sf(data = rock_climbing) + 
  theme_bw()

Issues and bugs

This package requires an internet connection as well as a connection to the Flickr API, which may not be constantly available.

If you discover a bug not associated with connection to the API that is not already a reported issue, please open a new issue providing a reproducible example.

ropensci_footer

About

Searches Flickr for photographs and metadata

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 91.0%
  • R 9.0%