SpatialPixelsDataFrame-class       package:sp       R Documentation

_C_l_a_s_s "_S_p_a_t_i_a_l_P_i_x_e_l_s_D_a_t_a_F_r_a_m_e" ~~~

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

     Class for spatial attributes that have spatial locations on a
     regular grid.

_O_b_j_e_c_t_s _f_r_o_m _t_h_e _C_l_a_s_s:

     Objects can be created by calls of the form 'as(x,
     "SpatialPixelsDataFrame")', where 'x' is of class
     SpatialPointsDataFrame-class, or by importing through rgdal.  
     Ordered full grids are stored instead or unordered non-NA cells;

_S_l_o_t_s:

     '_b_b_o_x': Object of class '"matrix"'; bounding box 

     '_p_r_o_j_4_s_t_r_i_n_g': Object of class '"CRS"'; projection 

     '_g_r_i_d': see GridTopology-class; grid parameters 

     '_g_r_i_d._i_n_d_e_x': integer; index of points in the list to points in
          the full (ordered) grid. x cycles fastest; all coordinates
          increase from low to hight except y, which decreases from
          high to low 

     '_d_a_t_a': Object of class AttributeList-class containing the
          attribute data 

_E_x_t_e_n_d_s:

     Class '"SpatialPixels"', directly. Class '"Spatial"', by class
     '"SpatialPixels"'.

_M_e_t_h_o_d_s:

     _c_o_o_r_d_i_n_a_t_e_s 'signature(x = "SpatialPixelsDataFrame")': retrieves
          (and calculates!) coordinates 

     [ 'signature(x = "SpatialPixelsDataFrame")': selects row(s) and/or
          attribute(s), and returns an object of class
          'SpatialPixelsDataFrame'; rows refer here to the pixel
          numbers, not grid lines. For selecting a square block in a
          grid, coerce to a SpatialGridDataFrame-class first, and use
          '[' on that object

     [[ 'signature(x = "SpatialPixelsDataFrame")': retrieves an
          attribute, dropping everything  else (topology) 

     [[<- 'signature(x = "SpatialPixelsDataFrame")': assigns or
          replaces an attribute 

     _a_s._m_a_t_r_i_x 'signature(x = "SpatialPixelsDataFrame")': coerce to
          matrix 

_N_o_t_e:

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

     Edzer J. Pebesma, e.pebesma@geo.uu.nl

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

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

     'SpatialPixels-class', which does not contain the attribute data

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

     data(meuse.grid) # only the non-missing valued cells
     coordinates(meuse.grid) = c("x", "y") # promote to SpatialPointsDataFrame
     gridded(meuse.grid) <- TRUE # promote to SpatialPixelsDataFrame
     meuse.grid[["idist"]] = 1 - meuse.grid[["dist"]] # assigns new attribute
     image(meuse.grid["idist"]) # note the single [

     # toy example:
     df = data.frame(z = c(1:6,NA,8,9),
         xc = c(1,1,1,2,2,2,3,3,3),
         yc = c(rep(c(0, 1.5, 3),3)))
     coordinates(df) = ~xc+yc
     gridded(df) = TRUE
     image(df["z"])
     # draw labels to verify:
     cc = coordinates(df)
     z=df[["z"]]
     zc=as.character(z)
     zc[is.na(zc)]="NA"
     text(cc[,1],cc[,2],zc)

