as.SpatialPolygons.GridTopology      package:sp      R Documentation

_M_a_k_e _S_p_a_t_i_a_l_P_o_l_y_g_o_n_s _o_b_j_e_c_t _f_r_o_m _G_r_i_d_T_o_p_o_l_o_g_y _o_b_j_e_c_t

_D_e_s_c_r_i_p_t_i_o_n:

     Converts grids of regular rectangles into a 'SpatialPolygons'
     object, which can be transformed to a different projection or
     datum. The function is not suitable for high-resolution grids. The
     ordering of the grid cells is as in 'coordinates()' of the same
     object, and is reported by 'IDvaluesGridTopology'.

_U_s_a_g_e:

     as.SpatialPolygons.GridTopology(grd, proj4string = CRS(as.character(NA)))
     IDvaluesGridTopology(obj)

_A_r_g_u_m_e_n_t_s:

 grd,obj: 'GridTopology' object

proj4string: projection string of class CRS

_V_a_l_u_e:

     'as.SpatialPolygons.GridTopology' returns a 'SpatialPolygons'
     object; 'IDvaluesGridTopology' returns a character vector with the
     'GridTopology' object column and row indices.

_S_e_e _A_l_s_o:

     'GridTopology', 'SpatialPolygons'

_E_x_a_m_p_l_e_s:

     grd <- GridTopology(cellcentre.offset=c(-175,55), cellsize=c(10,10), cells.dim=c(4,4))
     SpP_grd <- as.SpatialPolygons.GridTopology(grd)
     plot(SpP_grd)
     text(getSpPPolygonsLabptSlots(SpP_grd), getSpPPolygonsIDSlots(SpP_grd), cex=0.5)
     trdata <- data.frame(A=rep(c(1,2,3,4), 4), B=rep(c(1,2,3,4), each=4), row.names=getSpPPolygonsIDSlots(SpP_grd))
     SpPDF <- SpatialPolygonsDataFrame(SpP_grd, trdata)
     spplot(SpPDF)

