unionSpatialPolygons from the command-line
For package sp, I moved "methods" from Imports: to Depends: in order to avoid this problem with future sp versions or packages with sp in Depends:
On 08/04/16 13:15, Roger Bivand wrote:
On Thu, 7 Apr 2016, Stachelek, Joseph wrote:
Hello, I am trying to call "maptools::unionSpatialPolygons()" from the command-line. To illustrate the problem, I can call example(unionSpatialPolygons) from an interactive session but running an R script (testmaptools.R) containing: `library(maptools)` `example(unionSpatialPolygons)`
With R --vanilla < testmaptools.R and adding print(sessionInfo()) to the script, we see: attached base packages: [1] stats graphics grDevices utils datasets methods base and it runs correctly. With Rscript testmaptools.R we see: attached base packages: [1] stats graphics grDevices utils datasets base The script runs using Rscript if library(methods) is added as the first line. This issue has been seen elsewhere recently in another context, we don't know why. Hope this clarifies, Roger
yields: `$ Rscript testmaptools.R`
WARNING: ignoring environment value of R_HOME Loading required package: sp Checking rgeos availability: TRUE
unnSpP> if (rgeosStatus()) {
unnSpP+ nc1 <- readShapePoly(system.file("shapes/sids.shp",
package="maptools")[1],
unnSpP+ proj4string=CRS("+proj=longlat +datum=NAD27"))
unnSpP+ lps <- coordinates(nc1)
unnSpP+ ID <- cut(lps[,1], quantile(lps[,1]), include.lowest=TRUE)
unnSpP+ reg4 <- unionSpatialPolygons(nc1, ID)
unnSpP+ row.names(reg4)
unnSpP+ }
Error in rgeos::gUnaryUnion(spgeom = SpP, id = IDs) :
Invalid geometry, may only be applied to polygons
Calls: example ... eval -> eval -> unionSpatialPolygons -> <Anonymous>
Execution halted
Is this not possible?
Thank you,
Joseph Stachelek
We value your opinion. Please take a few minutes to shar...{{dropped:8}}
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Edzer Pebesma Institute for Geoinformatics (ifgi), University of M?nster Heisenbergstra?e 2, 48149 M?nster, Germany; +49 251 83 33081 Journal of Statistical Software: http://www.jstatsoft.org/ Computers & Geosciences: http://elsevier.com/locate/cageo/ Spatial Statistics Society http://www.spatialstatistics.info -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 490 bytes Desc: OpenPGP digital signature URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20160408/da77fca8/attachment.bin>