Description Usage Arguments Value Author(s) Examples
This function modifies an object of class data.frame to one of class SpatialPointsDataFrame
1 | DF2SpatialPointsDataFrame(x, coords = c("x", "y"), crs = sp::CRS("+init=epsg:28992"))
|
x |
data frame to be converted |
coords |
which columns are coordinates |
crs |
projection scheme |
the new object of class SpatialPointsDataFrame
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 | if (requireNamespace("sp", quietly = TRUE)) {
data("meuse", package = "sp", envir = environment())
meuseSP = DF2SpatialPointsDataFrame(meuse)
sp::plot(meuseSP, asp = 1, cex = 4 * meuse$zinc/max(meuse$zinc),
pch = 1, col = as.numeric(meuse$ffreq)+1 )
data("meuse.riv", package = "sp", envir = environment())
lines(meuse.riv)
} else {
print("package sp must be installed for this example")
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.