R Under development (unstable) (2023-05-27 r84465 ucrt) -- "Unsuffered Consequences" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > options("rgdal_show_exportToProj4_warnings"="none") > library(sp) The legacy packages maptools, rgdal, and rgeos, underpinning this package will retire shortly. Please refer to R-spatial evolution reports on https://r-spatial.org/r/2023/05/15/evolution4.html for details. This package is now running under evolution status 0 > if (require(rgeos, quietly = TRUE)) { + g = SpatialGrid(GridTopology(c(5,5), c(10,10), c(3,3))) + p = as(g, "SpatialPolygons") + p$z = c(1,0,1,0,1,0,1,0,1) + cc = coordinates(g) + #p$ag1 = aggregate(p, p, mean)[[1]] + #p$ag1a = aggregate(p, p, mean, minDimension = 0)[[1]] + #p$ag2 = aggregate(p, p, mean, minDimension = 1)[[1]] + #p$ag3 = aggregate(p, p, mean, minDimension = 2)[[1]] + #p$ag4 = aggregate(p, p, mean, areaWeighted=TRUE)[[1]] + pts = cbind(c(9,21,21,9,9),c(9,9,21,21,9)) + sq = SpatialPolygons(list(Polygons(list(Polygon(pts)), "ID"))) + rnd2 = function(x) round(x, 2) + #l = list( + # list("sp.text", cc, rnd2(p$z), which = 1), + # list("sp.text", cc, rnd2(p$ag1), which = 2), + # list("sp.text", cc, rnd2(p$ag1a), which = 3), + # list("sp.text", cc, rnd2(p$ag2), which = 4), + # list("sp.text", cc, rnd2(p$ag3), which = 5), + # list("sp.text", cc, rnd2(p$ag4), which = 6), + # list(sq, col = 'green', which = 6, first = FALSE, lwd = 2) + #) + #spplot(p, names.attr = c("source", "default aggregate", "minDimension=0", + # "minDimension=1", "minDimension=2", "areaWeighted=TRUE"), layout = c(3,2), + # as.table=TRUE, col.regions=bpy.colors(151)[50:151], cuts=100, + # sp.layout = l, scales = list(draw = TRUE)) + + #rnd2(c(aggregate(p, sq, mean)[[1]], + # aggregate(p, sq, mean, minDimension = 0)[[1]], + # aggregate(p, sq, mean, minDimension = 1)[[1]], + # aggregate(p, sq, mean, minDimension = 2)[[1]], + # aggregate(p, sq, mean, areaWeighted=TRUE)[[1]])) + } rgeos version: 0.6-3, (SVN revision 696) GEOS runtime version: 3.11.2-CAPI-1.17.2 Please note that rgeos will be retired during October 2023, plan transition to sf or terra functions using GEOS at your earliest convenience. See https://r-spatial.org/r/2023/05/15/evolution4.html for details. GEOS using OverlayNG Linking to sp version: 1.6-0 Polygon checking: TRUE > > proc.time() user system elapsed 0.45 0.06 0.45