[R] Static to interactive map (leaflet spplot)
Debasish Pai Mazumder
pai1981 at gmail.com
Wed Feb 3 00:28:21 CET 2016
Hi ALL,
I have a script to plot hexagonal polygon on a map. Its a static map. I
used spplot. I would like to convert this plot to interactive plot using "
*leaflet*". How do I make it interactive plot?
Here is spplot lines:
cl = map("world", xlim = c(-120, 20), ylim = c(-10, 70), plot = TRUE)
cl = map("world",plot = TRUE)
clp = map2SpatialLines(cl, proj4string = CRS(ll))
clp = spTransform(clp, CRS(lcc))
l2 = list("sp.lines", clp, col = "black", lty = 1, lwd = 3)
cr = colorRampPalette(brewer.pal(9,"YlOrRd"))(100)
require(grid)
spplot(hspdf, "CDP", col = "white", col.regions = cr,
sp.layout = list(l2),
at = seq(0,100,10),
sub = list("CDP", cex = 1.5, font = 2))
where
> hspdf
class : SpatialPolygonsDataFrame
features : 95
extent : -4141330, 3748528, 1530846, 6914278 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=lcc +lat_1=60 +lat_2=30 +lon_0=-60 +ellps=WGS84
variables : 4
names : hexid, count, hct, CDP
min values : 37, 1, 1, 0.136612021857923
max values : 448, 7, 3, 39.4391854927413
CDP values of each hexagonal polygon.
-Deb
[[alternative HTML version deleted]]
More information about the R-help
mailing list