I am trying to make a kernel density plot of a points shapefile like so:
library(rgdal) library(spatstat) library(maptools) points <- readOGR(dsn = "C:\\Documents", layer = "points") points$X <- coordinates(points)[,1] points$Y <- coordinates(points)[,2] aoi <- readOGR(dsn = "C:\\Documents", layer = "aoi") W <- as.owin.SpatialPolygons(aoi) pp <- ppp(points$X, points$Y, W = W)
but this returns:
Warning message: 7978 points were rejected as lying outside the specified window
which is the number of rows in
points. Both projections for
"+proj=utm +zone=14 +datum=NAD83 +units=m +no_defs +ellps=GRS80 +towgs84=0,0,0"
And when I plot:
plot(W) plot(points, add=T)
So my points do overlay, however I'm not sure why I get the error.