I'm trying to extract and plot some points on a raster. I did the following:
library(sp)
pt1 <- data.frame(cbind(4110000,40000))####almost completely degraded
pt2 <- data.frame(cbind(4100000,0))#####green
pt3 <- data.frame(cbind(4140000,55000))####slightly green
pt <- rbind(pt1, pt2, pt3)
coordinates(pt) <- c("X1","X2")
points(pt)
But, the line:
coordinates(pt) <- c("X1","X2")
is giving that error which is affecting the plotting:
Error in coordinates<-
(*tmp*
, value = c("X1", "X2")) :
setting coordinates cannot be done on Spatial objects, where they have already been set.....
Any advice please?