recenter-methods             package:sp             R Documentation

_M_e_t_h_o_d_s _f_o_r _F_u_n_c_t_i_o_n _r_e_c_e_n_t_e_r _i_n _P_a_c_k_a_g_e '_s_p'

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

     Methods for function 'recenter' in package 'sp' to shift or
     re-center geographical coordinates for a Pacific view. All
     longitudes < 0 are added to 360, to avoid for instance parts of
     Alaska being represented on the far left and right of a plot
     because they have values straddling 180 degrees. In general, using
     a projected coordinate reference system is to be prefered, but
     this method permits a geographical coordinate reference system to
     be used. This idea was suggested by Greg Snow, and corresponds to
     the two world representations in the 'maps' package.

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


     _o_b_j = "_S_p_a_t_i_a_l_R_i_n_g_s" recenter a SpatialRings object

     _o_b_j = "_S_r_i_n_g_s" recenter a Srings object 

     _o_b_j = "_S_r_i_n_g" recenter an Sring object 

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

     _o_b_j = "_S_l_i_n_e_s" recenter a Slines object 

     _o_b_j = "_S_l_i_n_e" recenter an Sline object 

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

     crds <- matrix(c(179, -179, -179, 179, 50, 50, 52, 52), ncol=2)
     SL <- SpatialLines(list(Slines(list(Sline(crds, CRS("+proj=latlong"))))))
     bbox(SL)
     SLr <- recenter(SL)
     bbox(SLr)
     rcrds <- rbind(crds, crds[1,])
     SR <- SpatialRings(list(Srings(list(Sring(rcrds, CRS("+proj=latlong"))), ID="r1")))
     bbox(SR)
     SRr <- recenter(SR)
     bbox(SRr)
     opar <- par(mfrow=c(1,2))
     plot(SR)
     plot(SRr)
     par(opar)
     crds <- matrix(c(-1, 1, 1, -1, 50, 50, 52, 52), ncol=2)
     SL <- SpatialLines(list(Slines(list(Sline(crds, CRS("+proj=latlong"))))))
     bbox(SL)
     SLr <- recenter(SL)
     bbox(SLr)
     rcrds <- rbind(crds, crds[1,])
     SR <- SpatialRings(list(Srings(list(Sring(rcrds, CRS("+proj=latlong"))), ID="r1")))
     bbox(SR)
     SRr <- recenter(SR)
     bbox(SRr)
     opar <- par(mfrow=c(1,2))
     plot(SR)
     plot(SRr)
     par(opar)

