subsetmap             package:adehabitat             R Documentation

_S_t_o_r_i_n_g _a _P_a_r_t _o_f _a _M_a_p

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

     'subsetmap' is a generic function.  It has methods for the classes
     'asc' and 'kasc'.  It is used to store a part of any given map
     into an other object.

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

     subsetmap(x, xlim = NULL, ylim = NULL, ...)

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

       x: an object of class 'asc' or 'kasc'

    xlim: numerical vector of length 2.  The x limits of the rectangle
          including the new map

    ylim: numerical vector of length 2.  The y limits of the rectangle
          including the new map

     ...: further arguments passed to or from other methods

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

     If 'xlim' or 'ylim' are not provided, the function asks the user
     to click on the map to delimit the lower left corner and the
     higher right corner of the new map (see Examples).

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

     Returns an object of class 'asc' or 'kasc'

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

     Clment Calenge calenge@biomserv.univ-lyon1.fr

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

     'as.asc', 'as.kasc'

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

     data(puechabon)
     kasc <- puechabon$kasc
     el <- getkasc(kasc, "Elevation")

     ## limits of the new map:
     xl <- c(701561, 704017)
     yl <- c(3160560, 3162343)

     ## computation of the new map:
     su <- subsetmap(el, xlim = xl, ylim = yl)

     ## Display
     opar <- par(mar = c(0,0,0,0))
     layout(matrix(c(1,1,1,1,1,1,1,1,2), byrow = TRUE, ncol = 3))
     image(el, axes = FALSE)
     polygon(c(xl[1], xl[2], xl[2], xl[1]),
             c(yl[1], yl[1], yl[2], yl[2]))
     image(su, axes = FALSE)
     box()

     par(opar)
     par(mfrow = c(1,1))

     ### Gets this part for the whole kasc object
     m <- subsetmap(kasc, xlim = xl, ylim = yl)
     image(m)

     ## Not run: 
      ## Interactive example 
      su <- subsetmap(kasc)

      image(su)
     ## End(Not run)

