File: sp2WB.Rd

package info (click to toggle)
r-cran-maptools 1%3A1.0-2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,968 kB
  • sloc: ansic: 3,022; makefile: 5; sh: 4
file content (42 lines) | stat: -rw-r--r-- 1,507 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
\encoding{latin1}
\name{sp2WB}
\alias{sp2WB}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{Export SpatialPolygons object as S-Plus map for WinBUGS}
\description{
  The function exports an sp SpatialPolygons object into a S-Plus map
format to be import by WinBUGS.
}
\usage{
sp2WB(map, filename, Xscale = 1, Yscale = Xscale, plotorder = FALSE)
}
%- maybe also 'usage' for other objects documented here.
\arguments{
  \item{map}{a SpatialPolygons object}
  \item{filename}{file where output is written}
  \item{Xscale, Yscale}{scales to be written in the output file}
  \item{plotorder}{default=FALSE, if TRUE, export polygons in plotting order}
}

\references{\url{http://www.mrc-bsu.cam.ac.uk/wp-content/uploads/geobugs12manual.pdf}}
\author{Virgilio Gómez Rubio, partly derived from earlier code by Thomas Jagger}


\examples{
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)
\dontrun{
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"))
}
}
\keyword{spatial}