Skip to contents

Returns image metadata for photos matching the search terms.

Usage

photo_search(
  mindate_taken = NULL,
  maxdate_taken = NULL,
  mindate_uploaded = NULL,
  maxdate_uploaded = NULL,
  user_id = NULL,
  text = NULL,
  tags = NULL,
  tags_any = TRUE,
  bbox = NULL,
  woe_id = NULL,
  sf_layer = NULL,
  has_geo = TRUE
)

Arguments

mindate_taken

Character, or date required. Minimum taken date. Photos with an taken date greater than or equal to this value will be returned. The date should be in the form of "YYYY-MM-DD".

maxdate_taken

Character, or date required. Maximum taken date. Photos with an taken date less than or equal to this value will be returned. The date should be in the form of "YYYY-MM-DD".

mindate_uploaded

Character or date, optional. Minimum upload date. Photos with an upload date greater than or equal to this value will be returned. The date can be in the form of a unix timestamp or mysql datetime.

maxdate_uploaded

Character or date, optional. Maximum upload date. Photos with an upload date less than or equal to this value will be returned. The date can be in the form of a unix timestamp or mysql datetime.

user_id

Character, optional. The Flickr ID of the user who's photo to search. If this parameter isn't passed then everybody's public photos will be searched.

text

Character, optional. A free text search. Photos who's title, description or tags contain the text will be returned. You can exclude results that match a term by prepending it with a - character. Free text searches for words in order provided, for example a search for "climbing rock" will be different to "rock climbing".

tags

Character vector, optional. A comma-delimited list of tags. Photos with one or more of the tags listed will be returned. You can exclude results that match a term by prepending it with a - character.

tags_any

Logical, optional. If TRUE, photos containing any of the tags will be returned. If FALSE, only photos containing all tags will be returned. Defaulted to return any tags.

bbox

String, optional bounding box of search area provide as: "minimum_longitude,minimum_latitude,maximum_longitude,maximum_latitude".

woe_id

String, optional "where on earth identifier" can be supplied instead of bbox. Use find_place to obtain woe_id for a place.

sf_layer

A simple features layer, optional, area to search for photos, can be supplied instead of a bbox or woeID.

has_geo

Logical, optional parameter for whether returned photos need associated spatial data.

Value

data.frame. Output consists of 57 variables including; latitude and longitude of photograph, date and time it was taken, associated tags and image urls.

Full list of variables returned:

  • id: photograph's unique id number

  • owner: the unique id of the Flickr user

  • secret: photograph unique secret number

  • server: Flickr server data

  • farm: Flickr server data

  • title: photograph title

  • ispublic: whether photograph is public; 1 = yes, 0 = no

  • isfriend whether user is friend; 1 = yes, 0 = no

  • isfamily whether user is family; 1 = yes, 0 = no

  • license: use licence of the image see https://www.flickr.com/services/api/flickr.photos.licenses.getInfo.html for details

  • datetaken: date and time of image capture

  • datetakengranularity: accuracy of image date see https://www.flickr.com/services/api/misc.dates.html for more information on dates

  • datetakenunknown: whether date is unknown see https://www.flickr.com/services/api/misc.dates.html for more information on dates

  • count_views: number of view the photograph has had,

  • count_comments: number of comments on the photograph

  • count_faves: number of times the photograph has been favourited

  • tags: user defined tags on the photograph

  • latitude: latitude of where the image was taken

  • longitude: longitude of where the image was taken

  • accuracy: accuracy of spatial reference see https://www.flickr.com/services/api/flickr.photos.search.html for more information

  • context: a numeric value representing the photo's geotagginess beyond latitude and longitude https://www.flickr.com/services/api/flickr.photos.search.html for more information

  • place_id: unique numeric number representing the location of the photograph

  • woeid: unique numeric number representing the location of the photograph

  • geo_is_family: whether only friends can see geo; 1 = yes, 0 = no

  • geo_is_friend: whether only family can see geo; 1 = yes, 0 = no

  • geo_is_contact: whether only contact can see geo; 1 = yes, 0 = no

  • geo_is_public whether geo is public; 1 = yes, 0 = no

  • url_sq: URL for square image

  • height_sq: height for square image

  • width_sq: width for square image

  • url_t: URL for square image thumbnail image 100 on longest side

  • height_t: height for thumbnail image 100 on longest side,

  • width_t: width for thumbnail image 100 on longest side

  • url_s: URL for small square image 75x75

  • height_s: height for small square image 75x75

  • width_s: width for small square image 75x75

  • url_q: URL for large square image 150x150

  • height_q: height for large square image 150x150

  • width_q: width for large square image 150x150

  • url_m: URL for small image 240 on longest side

  • height_m: height for small image 240 on longest side

  • width_m: width for small image 240 on longest side

  • url_n: URL for small image 320 on longest side

  • height_n: height for small image 320 on longest side

  • width_n: width for small image 320 on longest side

  • url_z: URL for medium image 640 on longest side

  • height_z: height for medium image 640 on longest side

  • width_z: width for medium image 640 on longest side

  • url_c: URL for medium image 800 on longest side

  • height_c: height for medium image 800 on longest side

  • width_c: width for medium image 800 on longest side

  • url_l: URL for large image 1024 on longest side

  • height_l: height for large image 1024 on longest side

  • width_l: width for large image 1024 on longest side

  • url_o: URL for original image, either a jpg, gif or png, depending on source format

  • height_o: height for original image, either a jpg, gif or png, depending on source format

  • width_o: width for original image, either a jpg, gif or png, depending on source format

  • description: Flickr user generated text description of the photograph

Details

Uses the flickr.photos.search API method from the Flickr API. This search method requires a limiting factor to prevent parameterless searches - to ensure this is met the function requires both a minimum and a maximum date that searched photographs were taken on. See https://www.flickr.com/services/api/flickr.photos.search.html for more information on the API method.

When running the function you need an API key saved as photosearcher_key.sysdata in your working directory. If this is the first function you run 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.

See also

Other Search for images: interesting_list()

Examples

if (FALSE) {
photo_search(
  mindate_taken = "2019-01-01",
  maxdate_taken = "2019-01-02",
  text = "tree",
  bbox = "-13.623047,47.279229,3.251953,60.630102",
  has_geo = TRUE
  )

photo_search(
  mindate_taken = "2017-01-01",
  maxdate_taken = "2017-01-02",
  mindate_uploaded = "2017-03-04",
  maxdate_uploaded = "2017-05-05",
  tags = "lake"
  )

photo_search(
  mindate_taken = "2018-01-01",
  maxdate_taken = "2018-01-03",
  tags = c("mountain", "lake"),
  tags_any = TRUE
)

photo_search(
  mindate_taken = "2018-01-01",
  maxdate_taken = "2018-01-03",
  tags = c("mountain", "lake"),
  tags_any = FALSE
)

}