I am trying to plot 3 different spatial data frames on top of one another - so far - only the first two have worked - pts
on bndry
Whenever I add polygon()
to the mix, I get the following error:
> plot(bndry, xlim = c(590900, 595900), ylim = c(4785786, 4793200))
> points(pts, col=colcode, pch=16)
> polygon(polys)
Error in as.double(y) :
cannot coerce type 'S4' to vector of type 'double'
To be sure, pts
and polys
are projected in the exact same CRS:
> polys@proj4string
CRS arguments:
+init=epsg:32617 +proj=utm +zone=17 +datum=WGS84 +units=m
+no_defs +ellps=WGS84 +towgs84=0,0,0
> pts@proj4string
CRS arguments:
+init=epsg:32617 +proj=utm +zone=17 +datum=WGS84 +units=m
+no_defs +ellps=WGS84 +towgs84=0,0,0
Is there a reason for this and a known workaround for this error ?