Description Usage Arguments Value Author(s) Examples
The PlotPolysOnStaticMap() function currently does not take sp objects directly but instead needs
PBSmapping type data.frames. This function converts sp objects into such.
THANKS TO Fabio Priuli for a major bug fix w.r.t. holes in spatial polygons!
1 | SpatialToPBS(xy, verbose = 0)
|
xy |
spatial object, such as SpatialPoints, SpatialPolygons, etc.. |
verbose |
level of verbosity |
list with elements xy = converted object, bb = bounding box, fun = plot function
Markus Loecher
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | if (interactive()) {
data("NYleukemia", envir = environment())
population <- NYleukemia$data$population
cases <- NYleukemia$data$cases
mapNY <- GetMap(center=c(lat=42.67456,lon=-76.00365),
destfile = file.path(tempdir(),"NYstate.png"),
maptype = "mobile", zoom=9)
#mapNY=ReadMapTile("NYstate.png")
clrStuff=ColorMap(100*cases/population, alpha = 0.35, log = TRUE)
NYpolys = SpatialToPBS(NYleukemia$spatial.polygon)
PlotPolysOnStaticMap(mapNY, NYpolys$xy, col = clrStuff$colcode, add = FALSE)
legend("topleft", legend = clrStuff$legend, fill = clrStuff$fill,
bg = rgb(0.1,0.1,0.1,0.3))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.