I have to plot in the same graph something like this:
Then, I have elements from SpatialPolygonDataFrame
class and others elements from SpatialGridDataFrame
class. When I try to plot them in the same graph only get this error:
Error in `[[<-.data.frame`(`*tmp*`, i, value = c(52.6195687909829, 52.6845097109409, :
replacement has 64 rows, data has 672.
However, I converted all elements to SpatialPolygonDataFrame
class, but it does not work.
I've watched the data and I think that the problem is the size of the elements (row, columns) but I'm not sure. I do not how to do it.
This is a example of my routine.
# Interpolation kriging
k_066_1617H <- krige(data066_1617H$Vtec~1,locations = data066_1617H,newdata = gridpolygon2,model = Ajuste2)
class(k_066_1617H)
#[1] "SpatialPolygonsDataFrame"
#attr(,"package")
#[1] "sp"
Then, read a TIFF file
land <- readGDAL("image.tif")
class(land)
#[1] "SpatialGridDataFrame"
#attr(,"package")
#[1] "sp"
land <- Grid2Polygons(land) # Transform into SpatialPolygonDataFrame
class(land)
#[1] "SpatialPolygonsDataFrame"
#attr(,"package")
#[1] "sp"
Construct a vector with land and k_066_1617H for plot with spplot
zn.k_066_1516H = land
zn.k_066_1617H = k_066_1617H
zn = land
zn[["a"]] = land[["z"]]
zn[["b"]] = zn.k_066_1617H[["var1.pred"]]
Here, is the problem. Maybe the size of elements is the problem.
land has 28 rows and 24 columns and k_066_1617H has 3752 rows.
spplot(zn, c("a","b"),
main = "Santander, VTEC día 066",
#names.attr = c("Prueba","18 - 19", "16 - 17"),
lty=0,
lwd=7,
sp.layout = c('sp.points', santos.coord, col='red', pch=19),
contour=TRUE,
col='black',
pretty=TRUE,
scales=list(draw = TRUE),
labels=TRUE)
No comments:
Post a Comment