elide-methods            package:maptools            R Documentation

_M_e_t_h_o_d_s _f_o_r _F_u_n_c_t_i_o_n _e_l_i_d_e _i_n _P_a_c_k_a_g_e '_m_a_p_t_o_o_l_s'

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

     Methods for function 'elide' to translate and disguise coordinate
     placing in the real world.

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

     elide(obj, ...)

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

     obj: object to be elided

     ...: other arguments:

          _b_b if NULL, uses bounding box of object, otherwise the given
               bounding box

          _s_h_i_f_t values to shift the coordinates of the input object;
               this is made ineffective by the scale argument

          _r_e_f_l_e_c_t reverse coordinate axes

          _s_c_a_l_e if NULL, coordinates not scaled; if TRUE, the longer
               dimension is scaled to lie within [0,1] and aspect
               maintained; if a scalar, the output range of [0,1] is
               multiplied by scale

          _f_l_i_p translate coordinates on the main diagonal

          _r_o_t_a_t_e default 0, rotate angle degrees clockwise around
               center

          _c_e_n_t_e_r default NULL, if not NULL, the rotation center,
               numeric of length two

          _u_n_i_t_s_q logical, default FALSE, if TRUE and scale TRUE, impose
               unit square bounding box (currently only points)

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

     The methods return objects of the input class object with elided
     coordinates; the coordinate reference system is not set. Note that
     if the input coordinates or centroids are in the data slot
     data.frame of the input object, they should be removed before the
     use of these methods, otherwise they will betray the input
     positions.

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



     _o_b_j = "_S_p_a_t_i_a_l_P_o_i_n_t_s" elides object

     _o_b_j = "_S_p_a_t_i_a_l_P_o_i_n_t_s_D_a_t_a_F_r_a_m_e" elides object

     _o_b_j = "_S_p_a_t_i_a_l_L_i_n_e_s" elides object

     _o_b_j = "_S_p_a_t_i_a_l_L_i_n_e_s_D_a_t_a_F_r_a_m_e" elides object

     _o_b_j = "_S_p_a_t_i_a_l_P_o_l_y_g_o_n_s" elides object

     _o_b_j = "_S_p_a_t_i_a_l_P_o_l_y_g_o_n_s_D_a_t_a_F_r_a_m_e" elides object

_N_o_t_e:

     Rotation code kindly contributed by Don MacQueen

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

     data(meuse)
     coordinates(meuse) <- c("x", "y")
     proj4string(meuse) <- CRS("+init=epsg:28992")
     data(meuse.riv)
     river_polygon <- Polygons(list(Polygon(meuse.riv)), ID="meuse")
     rivers <- SpatialPolygons(list(river_polygon))
     proj4string(rivers) <- CRS("+init=epsg:28992")
     rivers1 <- elide(rivers, reflect=c(TRUE, TRUE), scale=TRUE)
     meuse1 <- elide(meuse, bb=bbox(rivers), reflect=c(TRUE, TRUE), scale=TRUE)
     opar <- par(mfrow=c(1,2))
     plot(rivers, axes=TRUE)
     plot(meuse, add=TRUE)
     plot(rivers1, axes=TRUE)
     plot(meuse1, add=TRUE)
     par(opar)
     meuse1 <- elide(meuse, shift=c(10000, -10000))
     bbox(meuse)
     bbox(meuse1)
     rivers1 <- elide(rivers, shift=c(10000, -10000))
     bbox(rivers)
     bbox(rivers1)
     meuse1 <- elide(meuse, rotate=-30, center=apply(bbox(meuse), 1, mean))
     bbox(meuse)
     bbox(meuse1)
     plot(meuse1, axes=TRUE)

