## point data ##
# prepare data
data(quakes)
dat <- toGeoJSON(data=quakes, dest=tempdir())
# change circle borders
# note: if fill color is not specified, col is also used as fill color
sty <- styleSingle(col=2, lwd=1, alpha=1)
map <- leaflet(data=dat, dest=tempdir(), style=sty)
browseURL(map)
# change fill color, alpha and radius
sty <- styleSingle(fill="red", fill.alpha=1, rad=2)
map <- leaflet(data=dat, dest=tempdir(), style=sty)
browseURL(map)
# no border
sty <- styleSingle(col=NA)
map <- leaflet(data=dat, dest=tempdir(), style=sty)
browseURL(map)
# blank circle area
sty <- styleSingle(fill=NA)
map <- leaflet(data=dat, dest=tempdir(), style=sty)
browseURL(map)
# change all arguments
sty <- styleSingle(col="#d4d4d4", lwd=1, alpha=0.8,
fill="darkred", fill.alpha=0.4, rad=4)
map <- leaflet(data=dat, dest=tempdir(), style=sty)
browseURL(map)
## line data ##
# prepare data
dat <- toGeoJSON(data=system.file(package="leafletR", "files",
"lynx.dxf"), dest=tempdir())
# style
sty <- styleSingle(col="#bb650b", lwd=3, alpha=0.8)
map <- leaflet(data=dat, dest=tempdir(), style=sty)
browseURL(map)
## polygon data ##
# prepare data
dat <- toGeoJSON(data=system.file(package="leafletR", "files",
"park_sk.zip"), dest=tempdir())
# change borders
# note: if fill color is not specified, col is also used as fill color
sty <- styleSingle(col=3, lwd=2, alpha=1)
map <- leaflet(data=dat, dest=tempdir(), style=sty)
browseURL(map)
# change fill color and alpha
sty <- styleSingle(fill="darkgreen", fill.alpha=0.8)
map <- leaflet(data=dat, dest=tempdir(), style=sty)
browseURL(map)
# no border
sty <- styleSingle(col=NA)
map <- leaflet(data=dat, dest=tempdir(), style=sty)
browseURL(map)
# blank polygon area
sty <- styleSingle(fill=NA)
map <- leaflet(data=dat, dest=tempdir(), style=sty)
browseURL(map)
# change all arguments
sty <- styleSingle(col="#006400", lwd=5, alpha=0.8,
fill="darkgreen", fill.alpha=0.4)
map <- leaflet(data=dat, dest=tempdir(), style=sty)
browseURL(map)Run the code above in your browser using DataLab