download_os_datapackages {osdatahub}R Documentation

Download OS premium data packages

Description

Main function for downloading OS data packages to your local machine.

Usage

download_os_datapackages(product, ...)

## S3 method for class 'package_list'
download_os_datapackages(
  product,
  file_name,
  output_dir,
  overwrite = FALSE,
  key = get_os_key(),
  ...
)

## S3 method for class 'data.frame'
download_os_datapackages(
  product,
  version,
  file_name,
  output_dir,
  overwrite = FALSE,
  key = get_os_key(),
  ...
)

## S3 method for class 'numeric'
download_os_datapackages(
  product,
  version,
  file_name,
  output_dir,
  overwrite = FALSE,
  key = get_os_key(),
  ...
)

Arguments

product

A product_list object retrieved and filtered using list_os_datapackages. Alternatively, a data.frame object or integer or character string of a product ID that can be filtered further.

...

Additional parameters. Not currently used.

file_name

(character) Filter downloads to only include those with this file name. Optional.

output_dir

Path to the directory where the downloaded files will be saved.

overwrite

Boolean. Should existing files be overwritten? Default is FALSE.

key

(character) OS API key. Default action is to search for an environment variable using get_os_key().

version

(numeric or character) Retrieve information on a specific version(s) of a data product. Required when product is a data.frame.

Details

The OS Downloads API assists with the discovery and download of OS OpenData and OS premium data packages. This function is used as the main step to download data packages to your local machine. It is designed to work best after list_os_datapackages is first used to search and filter for the specific download product. The package_list returned by the listing step can be used as the input value to download the desired files. Alternatively, it is possible to supply a product and version IDs directly when they are already known.

Before downloading a data package, it must be ordered online. See: https://osdatahub.os.uk/downloads/packages.

For more information on the Downloads API, see https://osdatahub.os.uk/docs/downloads/technicalSpecification.

Value

Silently returns the directory where the downloaded files are stored.

See Also

list_os_datapackages

Examples

## Not run: 
# Search and filter available open products.
pkg_list <- list_os_datapackages()

# Use the package list to initiate a download.
# Note: 'version' will vary.
download_os_datapackages(pkg_list, version = 123, output_dir = tempdir())

## End(Not run)


[Package osdatahub version 0.2.0 Index]