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_P_o_l_y_g_o_n_s" recenter a SpatialPolygons object

     _o_b_j = "_P_o_l_y_g_o_n_s" recenter a Polygons object 

     _o_b_j = "_P_o_l_y_g_o_n" recenter an Polygon object 

     _o_b_j = "_S_p_a_t_i_a_l_L_i_n_e_s" recenter a SpatialLines object 

     _o_b_j = "_L_i_n_e_s" recenter a Lines object 

     _o_b_j = "_L_i_n_e" recenter an Line 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(Lines(list(Line(crds)))), CRS("+proj=latlong"))
     bbox(SL)
     SLr <- recenter(SL)
     bbox(SLr)
     rcrds <- rbind(crds, crds[1,])
     SpP <- SpatialPolygons(list(Polygons(list(Polygon(rcrds)), ID="r1")), proj4string=CRS("+proj=latlong"))
     bbox(SpP)
     SpPr <- recenter(SpP)
     bbox(SpPr)
     opar <- par(mfrow=c(1,2))
     plot(SpP)
     plot(SpPr)
     par(opar)
     crds <- matrix(c(-1, 1, 1, -1, 50, 50, 52, 52), ncol=2)
     SL <- SpatialLines(list(Lines(list(Line(crds)))), CRS("+proj=latlong"))
     bbox(SL)
     SLr <- recenter(SL)
     bbox(SLr)
     rcrds <- rbind(crds, crds[1,])
     SpP <- SpatialPolygons(list(Polygons(list(Polygon(rcrds)), ID="r1")), proj4string=CRS("+proj=latlong"))
     bbox(SpP)
     SpPr <- recenter(SpP)
     bbox(SpPr)
     opar <- par(mfrow=c(1,2))
     plot(SpP)
     plot(SpPr)
     par(opar)

