Extract in R fails for small polygons and raster
问题 This example should be reproducible, the first part (with large polygons) works, the second fails: library(raster) USA.altitude <- getData('alt', country='USA') lower48 <- USA.alt[[1]] Srs1 = Polygons(list(Polygon(cbind(c(-96,-95,-95,-96),c(40,40,41,40)))), "s1") Srs2 = Polygons(list(Polygon(cbind(c(-97,-96,-96,-97),c(40,40,41,40)))), "s2") spdf.large <- SpatialPolygonsDataFrame( SpatialPolygons(list(Srs1,Srs2)), data.frame( z=1:2, row.names=c("s1","s2") ) ) plot(spdf.large) usa.average.elev<