shp2SLDF                 package:sp                 R Documentation

_C_o_n_v_e_r_t_e_r _f_u_n_c_t_i_o_n_s _t_o _b_u_i_l_d _S_p_a_t_i_a_l_L_i_n_e_s_D_a_t_a_F_r_a_m_e _o_b_j_e_c_t_s

_D_e_s_c_r_i_p_t_i_o_n:

     These functions show how to build converters from external formats
     to build SpatialLinesDataFrame objects: 'shp2SLDF' from '"arc"'
     type ESRI shapefiles read into '"Map"' objects using the
     'read.shape()' function in the maptools package; 'arcobj2SLDF'
     from the list returned by the 'get.arcdata' function in the
     RArcInfo package; and 'contourLines2SLDF' from the list returned
     by the 'contourLines' function in the graphics package (here the
     data frame is just the contour levels, with one Lines object made
     up of at least one Line object per level). In addition,
     'Mapgen2SL' reads a file in "Mapgen" format into a 'SpatialLines'
     object.

_U_s_a_g_e:

     shp2SLDF(shp, proj4string = CRS(as.character(NA)), IDs)
     arcobj2SLDF(arc, proj4string=CRS(as.character(NA)), IDs)
     contourLines2SLDF(cL, proj4string=CRS(as.character(NA)))
     Mapgen2SL(file, proj4string=CRS(as.character(NA)))

_A_r_g_u_m_e_n_t_s:

     shp: a '"Map"' object returned by the 'read.shape()' function in
          the maptools package

     arc: a list returned by the 'get.arcdata' function in the RArcInfo
          package

      cL: a list returned by the 'contourLines' function in the
          graphics package

proj4string: Object of class '"CRS"'; see CRS-class

     IDs: vector of unique character identifiers; if not given,
          suitable defaults will be used, and the same values inserted
          as data slot row names

    file: filename of 

_V_a_l_u_e:

     A SpatialLinesDataFrame object

_N_o_t_e:

     Coastlines of varying resolution may be chosen online and
     downloaded in "Mapgen" text format from <URL:
     http://www.ngdc.noaa.gov/mgg/shorelines/shorelines.html>, but
     please note the 500,000 point limit on downloads, which is easy to
     exceed.

_A_u_t_h_o_r(_s):

     Roger Bivand; Edzer Pebesma

_S_e_e _A_l_s_o:

     SpatialLines-class

_E_x_a_m_p_l_e_s:

     data(lnsshp) # retrieved as: 
     # library(maptools)
     # lns <- read.shape(system.file("shapes/fylk-val.shp", package="maptools")[1])
     res <- shp2SLDF(lns)
     plot(res)
     invisible(title(""))
     data(co37_d90_arc) # retrieved as: 
     # library(RArcInfo)
     # fl <- "http://www.census.gov/geo/cob/bdy/co/co90e00/co37_d90_e00.zip"
     # download.file(fl, "co37_d90_e00.zip")
     # e00 <- zip.file.extract("co37_d90.e00", "co37_d90_e00.zip")
     # e00toavc(e00, "ncar")
     # arc <- get.arcdata(".", "ncar")
     res <- arcobj2SLDF(arc)
     plot(res)
     invisible(title(""))
     res <- contourLines2SLDF(contourLines(volcano))
     plot(res, col=terrain.colors(nrow(res@data)))
     invisible(title(""))

