polygrid                package:geoR                R Documentation

_C_o_o_r_d_i_n_a_t_e_s _o_f _P_o_i_n_t_s _I_n_s_i_d_e _a _P_o_l_y_g_o_n

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

     This function builds a rectangular grid and extracts points which
     are inside of an internal polygonal region.

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

     polygrid(xgrid, ygrid, borders, vec.inout = FALSE, ...)

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

   xgrid: grid values in the _x_-direction.  

   ygrid: grid values in the _y_-direction.  

 borders: a matrix with polygon coordinates defining the borders of the
          region.  

vec.inout: logical. If 'TRUE' a logical vector is included in the
          output indicating whether each point of the grid is inside
          the polygon.  Defaults to 'FALSE'.  

     ...: currently not used (kept for back compatibility). 

_D_e_t_a_i_l_s:

     The function works as follows: First it creates a grid using the
     R{} function 'expand.grid' and then it uses the geoR' internal
     function '.geoR_inout()' which wraps usage of 'SpatialPoints' and
     'overlay' from the package 'sp' to extract the points of the grid
     which are inside the polygon.

     Within the package 'geoR' this function is typically used to
     select points in a non-rectangular region to perform spatial
     prediction using 'krige.bayes', 'krige.conv' or 'ksline'. It is
     also useful to produce image or perspective plots of the
     prediction results.

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

     A list with components: 

  xypoly: an n x 2 matrix with the coordinates of the points inside the
          polygon.  

vec.inout: logical, a vector indicating whether each point of the
          rectangular grid is inside the polygon. Only returned if
          'vec.inout = TRUE'.  

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

     Paulo Justiniano Ribeiro Jr. paulojus@leg.ufpr.br, 
      Peter J. Diggle p.diggle@lancaster.ac.uk.

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

     Further information on the package 'geoR' can be found at:
      <URL: http://www.leg.ufpr.br/geoR>.

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

     'expand.grid', 'overlay', 'SpatialPoints'.

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

      poly <- matrix(c(.2, .8, .7, .1, .2, .1, .2, .7, .7, .1), ncol=2)
      plot(0:1, 0:1, type="n")
      lines(poly)
      poly.in <- polygrid(seq(0,1,l=11), seq(0,1,l=11), poly, vec=TRUE)
      points(poly.in$xy)

