readSplus              package:maptools              R Documentation

_R_e_a_d _e_x_p_o_r_t_e_d _W_i_n_B_U_G_S _m_a_p_s

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

     The function permits an exported WinBUGS map to be read into an
     'sp' package class 'SpatialPolygons' object.

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

     readSplus(file, proj4string = CRS(as.character(NA)))

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

    file: name of file

proj4string: Object of class '"CRS"'; holding a valid proj4 string

_V_a_l_u_e:

     'readSplus' returns a SpatialPolygons object

_N_o_t_e:

     In the example, taken from the GeoBUGS manual, the smaller part of
     area1 has a counter-clockwise ring direction in the data, while
     other rings are clockwise. This implies that it is a hole, and
     does not get filled. Errant holes may be filled using
     'checkPolygonsHoles'. The region labels are stored in the 'ID'
     slots of the 'Polygons' objects.

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

     Virgilio Gomez Rubio <Virgilio.Gomez@uclm.es>

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

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

_S_e_e _A_l_s_o:

     'map2SpatialPolygons'

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

     geobugs <- readSplus(system.file("share/Splus.map", package="maptools"))
     plot(geobugs, axes=TRUE, col=1:3)
     sapply(slot(geobugs, "polygons"), slot, "ID")
     pls <- slot(geobugs, "polygons")
     sapply(pls, function(i) sapply(slot(i, "Polygons"), slot, "hole"))
     pls1 <- lapply(pls, checkPolygonsHoles)
     sapply(pls1, function(i) sapply(slot(i, "Polygons"), slot, "hole"))
     plot(SpatialPolygons(pls1), axes=TRUE, col=1:3)

