tonerToTrans {mapmisc} | R Documentation |
Stamen-toner maps are 3-layer RGB rasters, which are converted to single-layer rasters with indexed colours with whites becoming transparent.
tonerToTrans(x, pattern="(red|green|blue)$", power = 0.5, col='black', threshold=Inf) rgbtToIndex(x, pattern="(red|green|blue|trans)$")
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 |
The difference between these functions is that tonerToTrans
converts white to transparent, whereas rgbtToIndex
uses the transparency layer. The former is intended for 'stamen-toner'
maps.
A RasterLayer
with indexed colours
Patrick Brown
## Not run: rgbMap = openmap(c(0,10), zoom=3, path='stamen-toner') names(rgbMap) plotRGB(rgbMap) transMap = tonerToTrans(rgbMap, col='blue') names(transMap) par(bg='red') plot(transMap) rgbMap[['stamen.tonerTrans']] = 255-rgbMap[['stamen.tonerRed']] rgbtMap = rgbtToIndex(rgbMap) plot(rgbtMap) ## End(Not run)