tonerToTrans {mapmisc} | R Documentation |
Convert RGB maps to semi-transparent
Description
Stamen-toner maps are 3-layer RGB rasters, which are converted to single-layer rasters with indexed colours with whites becoming transparent.
Usage
tonerToTrans(x, pattern="(red|green|blue)$", power = 0.5,
col='black', threshold=Inf, mostCommon=1)
Arguments
x |
A |
pattern |
string passed to |
power |
Values below 1 increase opacity, above 1 increases transparency |
col |
colour for resulting map |
threshold |
colours above this value are transparent |
mostCommon |
integer vector, the most common colours are converted to transparent |
Value
A SpatRast
with indexed colours
Author(s)
Patrick Brown
See Also
Examples
origMap = openmap(
c(-11, 9),
path='cartodb-nolabels',
buffer=2, verbose=TRUE
)
oldpar= map.new(origMap, bg='green')
plot(origMap, add=TRUE)
transMap = tonerToTrans(origMap, mostCommon=1)
names(transMap)
map.new(transMap, bg='green')
plot(transMap, add=TRUE)
par(oldpar)
[Package mapmisc version 2.1.0 Index]