sp2WB            package:maptools            R Documentation(latin1)

_E_x_p_o_r_t _S_p_a_t_i_a_l_P_o_l_y_g_o_n_s _o_b_j_e_c_t _a_s _S-_P_l_u_s _m_a_p _f_o_r _W_i_n_B_U_G_S

_D_e_s_c_r_i_p_t_i_o_n:

     The function exports an sp SpatialPolygons object into a S-Plus
     map format to be import by WinBUGS.

_U_s_a_g_e:

     sp2WB(map, filename, Xscale = 1, Yscale = Xscale, plotorder = FALSE)

_A_r_g_u_m_e_n_t_s:

     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

_A_u_t_h_o_r(_s):

     Virgilio Gmez Rubio, partly derived from earlier code by Thomas
     Jagger

_R_e_f_e_r_e_n_c_e_s:

     <URL:
     http://www.mrc-bsu.cam.ac.uk/bugs/winbugs/geobugs12manual.pdf>

_E_x_a_m_p_l_e_s:

     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.SpatialPolygons.SpatialPixels(xp)
     sp2WB(pp, filename="test.map")
     ## End(Not run)

