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 Slines object made
     up of at least one Sline 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(""))

