Learn R Programming

photon (version 0.3.5)

download_searchindex: Download search index

Description

Finds and downloads the Elasticsearch index database necessary to set up Photon locally.

Usage

download_searchindex(
  path = ".",
  country = "Monaco",
  date = "latest",
  exact = FALSE,
  section = NULL,
  only_url = FALSE,
  quiet = FALSE
)

Value

If only_url = FALSE, returns the local path to the downloaded file. Otherwise, returns the URL to the remote file.

Arguments

path

Path to a directory where the identified file should be stored.

country

Character string that can be identified by countryname as a country. An extract for this country will be downloaded. If "planet", downloads a global search index.

date

Character string or date-time object used to specify the creation date of the search index. If "latest", will download the file tagged with "latest". If a character string, the value should be parseable by as.POSIXct. If exact = FALSE, the input value is compared to all available dates and the closest date will be selected. Otherwise, a file will be selected that exactly matches the input to date.

exact

If TRUE, exactly matches the date. Otherwise, selects the date with lowest difference to the date parameter.

section

Subdirectory of the download server from which to select a search index. If "experimental", selects a dump made for the master version of photon. If "archived", selects a dump made for an older version of photon. If NULL (or any arbitrary string), selects a dump made for the current release. Defaults to NULL.

only_url

If TRUE, performs a download. Otherwise, only returns a link to the file.

quiet

If TRUE, suppresses all informative messages.

Examples

Run this code
# download the latest extract of Monaco
download_searchindex(path = tempdir())

# download the latest extract of American Samoa
download_searchindex(path = tempdir(), country = "Samoa")

# download an extract from a month ago
download_searchindex(
  path = tempdir(),
  country = "Monaco",
  date = Sys.time() - 2629800
 )

# if possible, download an extract from today
try(download_searchindex(
  path = tempdir(),
  country = "Monaco",
  date = Sys.Date(),
  exact = TRUE
))

# get the latest global coverage
# NOTE: the file to be downloaded is several tens of gigabytes of size!
if (FALSE) {
download_searchindex(path = tempdir(), country = "planet")}

Run the code above in your browser using DataLab