The function getelev
allows for the download of an elevation raster from internet. It downloads the "Global Multi-resolution Terrain Elevation Data 2010" from our server. The file was orifginally downloaded from: http://topotools.cr.usgs.gov/gmted_viewer/ and converted into a tif file by us. The function getelev
uses the generic function downloadfile
that can also be used to download directly other files.
getelev(
path=NULL,
overwrite=FALSE,
verbose=interactive()
) downloadfile(
address=NULL,
filename=NULL,
path=NULL,
overwrite=FALSE,
md5sum=NULL,
verbose=interactive()
)
A string indicating where to store the file on the hard drive
A logical indicating if an existing file should be re-downloaded
A logical indicating whether information about the progress of the procedure should be displayed or not while the function is running. By default verbose is TRUE
if users use an interactive R session and FALSE
otherwise. If a numeric is provided instead, additional information about the download will be provided if the number is greater than 1.
A string indicating where to download the file from
A string indicating the name of the file to be writen on the disk
An optional string indicating the MD5 hashes of the file for testing its integrity
In the argument "path" is not provided, the file will be stored in the current working directory. The functions can create new directories, so you can also indicate a new path. If the package tools is installed, the integrity of the elevation raster is tested after a call to getelev
. In case of corruption, try downloading the file again, specifying overwrite=TRUE to overwrite the corrupted file.
# NOT RUN {
## To download the high resolution
## raster in your current working
## directory, just type:
## getelev()
# }
Run the code above in your browser using DataLab