Export CanVec Data

Share:

Description

Export layers for one or more NTS reference(s) ntsid to path tofolder, automatically renaming layers based on their layerid. Pass crs to re-project data, or pass driver to convert file format.

Usage

1
2
canvec.export(ntsid, tofolder, layers = NULL, crs = NULL, cachedir = NULL,
  driver = NULL, combine = TRUE, overwrite = TRUE, ...)

Arguments

ntsid

One or more NTS References as generated by nts()

tofolder

A directory to which files should be copied.

layers

One or more layer ids as listed in canvec_layers$id. Defaults to all layers.

crs

A CRS (as generated by sp::CRS()) in which to project the data.

cachedir

Pass a specific cache directory in which files have been extracted. Default value is that returned by canvec.cachedir()

driver

A rgdal driver with which to save data. ESRI Shapefile, KML, CSV, and GML have been tested; others returned by rgdal::ogrDrivers() may also work.

combine

TRUE if output should be one file per layer, FALSE otherwise

overwrite

TRUE if files should overwrite files already in output directory.

...

Arguments passed on to sp::writeOGR()

Examples

1
2
3
4
5
6
7
canvec.download(nts("21h01"))
canvec.export(nts("21h01"), "exporteddata", layers=c("road", "river"))
canvec.export(nts("21h01"), "exporteddataUTM", layers=c("road", "river"), 
                 crs=sp::CRS("+init=epsg:26920"))
canvec.export(nts("21h01"), "exporteddata", layers=c("road", "river"), 
               driver="KML")
canvec.export(nts("21h01"), "exporteddataALL")