Skip to contents

[Experimental]

Download BC DEM data in gridded Canadian Digital Elevation Data (CDED) format.

WARNING: this function is still unstable, and will cause your R Session to abort if you download a large number of tiles. But do not despair! If you download many tiles and your R Session aborts while attempting to stitch your rasters together, the downloaded and unzipped .dem files are somewhere on your machine - R just ran out of memory when actually trying to stitch them together. If you open a new R Session and enter tempdir() into the console, your raster data is somewhere in that vicinity, in one of the Rtmp*/DEM_ZIP/DEM directories on your computer. No need go through the time consuming step of re-downloading all your rasters.

Usage

BC_DEM(
  letterblock,
  save_output = TRUE,
  overwrite = FALSE,
  output_dir = NA,
  filename = NA
)

Arguments

letterblock

Map tiles of DEM data to download, e.g. '92b'. See the BC Maps & Orthos Base Map Online Store here for a visual: https://a100.gov.bc.ca/ext/mtec/public/products/mapsheet

save_output

Logical (T/F). Should the downloaded DEM be saved to your local disk? Default TRUE.

overwrite

Logical (T/F). Should the downloaded DEM overwrite any existing BC DEM data on the disk, if already present? Default FALSE.

output_dir

Output directory to save downloaded DEM to. Defaults to current working directory.

filename

Filename of saved DEM. By default, the filename is either 1) the letterblock names, seperated by underscores (e.g., "92b_92g.dem"), if there are fewer than 5 letterblocks were downloaded; or 2) simply "BC_DEM.dem", if greater than 5 letterblocks were downloaded.

Value

A RasterSpat object.

Examples

if (FALSE) {
BC_DEM("92b", save_output = F) # download Victoria area DEM, don't save it
BC_DEM("103f", output_dir = "temp/bc_dem", filename = "haida_gwaii.dem") # download one tile of Haida Gwaii DEM and save output to "temp/bc_dem/haida_gwaii.dem"
}