canvec.qplot: Quickly Plot Canvec Data

Description Usage Arguments Value Examples

View source: R/canvec.qplot.R

Description

Quickly plot CanVec data with options to change the plotting style of each. If data does not exist in the cache it will be downloaded. Simplest usage uses searchbbox() to find an appropriate bounding box (e.g. canvec.qplot(bbox=searchbbox("Wolfville NS"))). Be careful plotting feature-intensive layers (e.g. "road", "building") over large areas (e.g. searchbbox("toronto, on")). This will happily run but plotting the map may take up to 20 minutes!

Usage

1
2
3
4
canvec.qplot(ntsid = NULL, bbox = NULL, layers = c("waterbody", "forest",
  "contour", "river", "road"), options = NULL, data = NULL,
  cachedir = NULL, plotdata = TRUE, atscale = nts.SCALE50K,
  stoponlargerequest = TRUE, epsg = NULL, ...)

Arguments

ntsid

One or more NTS References as generated by nts()

bbox

A bounding box describing the desired extent. If no ntsid is provided, nts(bbox=bbox) will be invoked to find the appropriate NTS Reference(s)

layers

A list of layers as defined in canvec_layers$id in the order in which they should be plotted

options

A list object containing the options for each layer in the form options$layerid <- list(col="lightblue")

data

A list object that contains the loaded Spatial* data to be plotted. This should always be an object that was returned by canvec.qplot()

cachedir

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

plotdata

TRUE if data should be plotted, FALSE if data should just be loaded.

atscale

One of nts.SCALE50K (CanVec data) or nts.SCALE250K (CanVec+ data)

stoponlargerequest

Stop if a large (greater than 4 tiles) area is requested. Defaults to TRUE.

epsg

The epsg code in which to plot the data, or NULL for automatic. Use epsg=3857 to layer on Open Street Map tiles, or epsg=269XX (where XX is the UTM Zone) for a UTM projection. Defaults to no projection, although sp::plot adjusts the aspect such that the default does not appear distorted.

...

A list of graphical parameters passed to the inital call to plot(). Use add=TRUE to layer on an existing plot.

Value

A list object that contains the Spatial* data that was plotted

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 #simplest use using searchbbox() from {prettymapr}
 library(prettymapr)
 wolfville <- searchbbox("Wolfville NS", source="google")
 canvec.qplot(bbox=wolfville)
 canvec.qplot(bbox=wolfville, layers=c("waterbody", "forest"))

 #can also plot by NTS sheet and use bbox= or xlim, ylim to zoom.
 canvec.qplot(nts("21h1"), layers=c("waterbody", "forest", "contour", "river", "road"))
 canvec.qplot(bbox=makebbox(45.1, -64.35, 45.05, -64.4), 
        layers=c("waterbody", "contour", "river", "building", "building_poly", "road"))

 #method returns plot data argument so data does not need to be loaded each time. 
 #this will not work when changing nts sheets.
 plotdata <- canvec.qplot(nts("21h1"), layers=c("waterbody", "forest", "contour", "river"))
 plotdata <- canvec.qplot(bbox=makebbox(45.1, -64.35, 45.05, -64.4), 
                        layers=c("waterbody", "contour", "river"),
                        data=plotdata)
 
 #use with prettymapr::addscalebar() and prettymapr::addnortharrow()
 library(prettymapr)
 wolfville <- searchbbox("Wolfville NS", source="google")
 canvec.qplot(bbox=wolfville)
 addscalebar()
 addnortharrow()
 
 #or use with prettymapr::prettymap() to set margins and add north arrow/
 #scalebar
 prettymap(canvec.qplot(bbox=wolfville))
 
 

rcanvec documentation built on May 2, 2019, 9:28 a.m.