Description Usage Arguments Author(s) References Examples
The function exports an sp SpatialPolygons object into a S-Plus map format to be import by WinBUGS.
1 |
map |
a SpatialPolygons object |
filename |
file where output is written |
Xscale, Yscale |
scales to be written in the output file |
plotorder |
default=FALSE, if TRUE, export polygons in plotting order |
Virgilio Gómez Rubio, partly derived from earlier code by Thomas Jagger
http://www.mrc-bsu.cam.ac.uk/wp-content/uploads/geobugs12manual.pdf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | xx <- readShapePoly(system.file("shapes/sids.shp", package="maptools")[1],
IDvar="FIPSNO", proj4string=CRS("+proj=longlat +ellps=clrk66"))
plot(xx, border="blue", axes=TRUE, las=1)
tf <- tempfile()
sp2WB(as(xx, "SpatialPolygons"), filename=tf)
xxx <- readSplus(tf, proj4string=CRS("+proj=longlat +ellps=clrk66"))
all.equal(xxx, as(xx, "SpatialPolygons"), tolerance=.Machine$double.eps^(1/4),
check.attributes=FALSE)
## Not run:
x <- readAsciiGrid(system.file("grids/test.ag", package="maptools")[1])
xp <- as(x, "SpatialPixelsDataFrame")
pp <- as(xp, "SpatialPolygons")
td <- tempdir()
sp2WB(pp, filename=file.path(td, "test.map"))
## End(Not run)
|
Loading required package: sp
Checking rgeos availability: FALSE
Note: when rgeos is not available, polygon geometry computations in maptools depend on gpclib,
which has a restricted licence. It is disabled by default;
to enable gpclib, type gpclibPermit()
Warning message:
readShapePoly is deprecated; use rgdal::readOGR or sf::st_read
[1] "Names: 100 string mismatches"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.