
this function produces an interactive view of the specified raster object(s) on a plain grey background but for any CRS.
# S4 method for RasterLayer
plainView(x,
maxpixels = mapviewGetOption("plainview.maxpixels"),
col.regions = mapviewGetOption("raster.palette")(256), at,
na.color = mapviewGetOption("na.color"), legend = TRUE,
verbose = mapviewGetOption("verbose"), layer.name = deparse(substitute(x,
env = parent.frame())), gdal = TRUE, ...)# S4 method for RasterStackBrick
plainView(x, r = 3, g = 2, b = 1,
na.color = mapviewGetOption("na.color"),
maxpixels = mapviewGetOption("plainview.maxpixels"),
layer.name = deparse(substitute(x, env = parent.frame())), ...)
# S4 method for SpatialPixelsDataFrame
plainView(x, zcol = 1, ...)
# S4 method for ANY
plainview(...)
a raster
* object
integer > 0. Maximum number of cells to use for the plot.
If maxpixels < ncell(x)
, sampleRegular is used before plotting.
color (palette).See levelplot
for details.
the breakpoints used for the visualisation. See
levelplot
for details.
color for missing values.
logical, whether to draw a legend for the raster layer.
should some details be printed during the process
the name of the layer to be shown on the map
logical. If TRUE (default) gdalUtils::gdal_translate is used to create the png file for display when possible. See details for further information.
additional arguments passed on to repective functions.
See addRasterImage
, addCircles
,
addPolygons
, addPolylines
for details
integer. Index of the Red channel, between 1 and nlayers(x)
integer. Index of the Green channel, between 1 and nlayers(x)
integer. Index of the Blue channel, between 1 and nlayers(x)
attribute name or column number in attribute table of the column to be rendered
SpatialPixelsDataFrame
: SpatialPixelsDataFrame
ANY
: alias for ease of typing
If the raster object is not in memory
(i.e. if raster::inMemory
is FLASE
)
and argument gdal
is set to TRUE (default) gdalUtils::gdal_translate
is used to translate the rsater object to a png file to be rendered in
the viewer/browser. This is fast for large rasters. In this case, argument
maxpixels
is not used, instead the image is rendered in original resolution.
However, this means that RasterLayers will be shown in greyscale.
If you want to set a color palette manually, use gdal = FALSE
and
(optionally provide) col.regions
.
For plainView there are a few keyboard shortcuts defined:
plus/minus - zoom in/out
space - toggle antialiasing
esc - zoom to layer extent
enter - set zoom to 1
ctrl - increase panning speed by 10
# NOT RUN {
### 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)
# SpatialPixelsDataFrame
plainView(meuse.grid, zcol = "dist")
# raster layer
m1 <- plainView(poppendorf[[5]])
m1
# raster stack
plainview(poppendorf, 4, 3, 2)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab