R version 4.2.2 Patched (2022-11-10 r83330) -- "Innocent and Trusting" Copyright (C) 2022 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) 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) > 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-1, (SVN revision 692) GEOS runtime version: 3.11.1-CAPI-1.17.1 Please note that rgeos will be retired during 2023, plan transition to sf functions using GEOS at your earliest convenience. GEOS using OverlayNG Linking to sp version: 1.5-1 Polygon checking: TRUE > > proc.time() user system elapsed 0.569 0.755 0.428
Generated by dwww version 1.15 on Sun Jun 30 10:21:08 CEST 2024.