Learn R Programming

mapview (version 1.0.0)

plainView: View spatial objects interactively without background map but in any CRS

Description

this function produces an interactive view of the specified spatial object(s) on a plain grey background but for any CRS.

Usage

## S3 method for class 'RasterLayer':
plainView(x,
  maxpixels = mapviewGetOption("maxpixels"),
  col.regions = mapviewGetOption("raster.palette")(256), at,
  na.color = mapviewGetOption("na.color"),
  verbose = mapviewGetOption("verbose"), layer.name = deparse(substitute(x,
  env = parent.frame())), ...)

## S3 method for class 'RasterStackBrick': plainView(x, r = 3, g = 2, b = 1, na.color = mapviewGetOption("na.color"), maxpixels = mapviewGetOption("maxpixels"), layer.name = deparse(substitute(x, env = parent.frame())), ...)

## S3 method for class 'SpatialPixelsDataFrame': plainView(x, zcol = 1, ...)

## S3 method for class 'ANY': plainview(...)

Arguments

x
a raster* object
maxpixels
integer > 0. Maximum number of cells to use for the plot. If maxpixels < ncell(x), sampleRegular is used before plotting.
col.regions
color (palette).See levelplot for details.
at
the breakpoints used for the visualisation. See levelplot for details.
na.color
color for missing values
verbose
should some details be printed during the process
layer.name
the name of the layer to be shown on the map
...
additional arguments passed on to repective functions. See addRasterImage, addCircles, addPolygons
r
integer. Index of the Red channel, between 1 and nlayers(x)
g
integer. Index of the Green channel, between 1 and nlayers(x)
b
integer. Index of the Blue channel, between 1 and nlayers(x)
zcol
attribute name or column number in attribute table of the column to be rendered

Methods (by class)

Examples

Run this code
plainView()

### raster data ###
library(sp)
library(raster)

data(meuse.grid)
coordinates(meuse.grid) = ~x+y
proj4string(meuse.grid) <- CRS("+init=epsg:28992")
gridded(meuse.grid) = TRUE
meuse_rst <- stack(meuse.grid)

# raster stack
m1 <- plainView(poppendorf[[10]])
m1

# SpatialPixelsDataFrame
plainView(meuse.grid, zcol = "soil")


### point vector data ###
## SpatialPointsDataFrame ##
data(meuse)
coordinates(meuse) <- ~x+y
proj4string(meuse) <- CRS("+init=epsg:28992")

# all layers of meuse
plainView(meuse, burst = TRUE)

# only one layer, all info in popups
plainView(meuse)

## SpatialPoints ##
meuse_pts <- as(meuse, "SpatialPoints")
plainView(meuse_pts)



### overlay vector on top of raster ###
plainView(meuse.grid, zcol = "ffreq") + meuse

### polygon vector data ###
data("gadmCHE")
m <- plainView(gadmCHE)
m

## points on polygons ##
centres <- data.frame(coordinates(gadmCHE))
names(centres) <- c("x", "y")
coordinates(centres) <- ~ x + y
projection(centres) <- projection(gadmCHE)
m + centres

### lines vector data
data("atlStorms2005")
plainView(atlStorms2005)
plainView(atlStorms2005, burst = TRUE)

Run the code above in your browser using DataLab