fetchUSGSTiles: USGS Lidar Toolkit - Download Lidar Tiles

View source: R/FetchFunctions.R

fetchUSGSTilesR Documentation

USGS Lidar Toolkit – Download Lidar Tiles

Description

Download one or more files (usually lidar data tiles) described by a list of URLs and place them in a folder.

Usage

fetchUSGSTiles(destfolder = "", urls, refresh = FALSE, method = "libcurl", ...)

Arguments

destfolder

A character string with the name of the folder where the downloaded tiles should be saved. If empty, tiles are saved in the current working directory. The folder name should not include a trailing slash. The folder will be created if it does not exist.

urls

A list of character strings with the URLs for tiles to fetch.

refresh

Logical value indicating files that already exist in destfolder should be fetched again. The default behavior is to skip existing files. For skipped files, the return value is set to 0 indicating a successful fetch. The default behavior can be problematic when you have urls that targets files in different folders but have the same file name.

method

Method used with download.file()

...

Additional arguments passed to download.file()

Details

When retrieving large files, it may be necessary to increase the timeout period so downloads can complete. This is done using the following line of code (sets timeout to 5000 seconds):

options(timeout = max(5000, getOption("timeout")))

Value

An (invisible) atomic vector of integer codes corresponding to the urls. The values are those returned from the download.file function calls for each of the urls, 0 for success and non-zero for failure. You can easily count the number of urls successfully fetched using sum(value == 0, na.rm = TRUE).

Examples

## Not run: 
fetchUSGSTiles("", URLlist)

## End(Not run)

bmcgaughey1/USGSlidar documentation built on June 23, 2024, 1:25 a.m.