readOGR                package:rgdal                R Documentation

_R_e_a_d _O_G_R _v_e_c_t_o_r _m_a_p_s _i_n_t_o _S_p_a_t_i_a_l _o_b_j_e_c_t_s

_D_e_s_c_r_i_p_t_i_o_n:

     The function reads an OGR data source and layer into a suitable
     Spatial vector object. It can only handle layers with conformable
     geometry features (not mixtures of points, lines, or polygons in a
     single layer). It will set the spatial reference system if the
     layer has such metadata.

_U_s_a_g_e:

     readOGR(dsn, layer, verbose = TRUE)
     ogrInfo(dsn, layer)
     ogrFIDs(dsn, layer)

_A_r_g_u_m_e_n_t_s:

     dsn: data source name (interpretation varies by driver - for some
          drivers, dsn is a file name, but may also be a folder)

   layer: layer name (varies by driver, may be a file name without
          extension)

 verbose: report progress

_D_e_t_a_i_l_s:

     The drivers available will depend on the installation of GDAL/OGR,
     and can vary. Note that stray files in data source directories
     (such as *.dbf) may lead to suprious errors that accompanying
     *.shp are missing.

_V_a_l_u_e:

     A Spatial object is returned suiting the vector data source,
     either a SpatialPointsDataFrame (using an AttributeList for its
     data slot directly), a SpatialLinesDataFrame, or a
     SpatialPolygonsDataFrame.

_N_o_t_e:

     The bases for this implementation are taken from functions in
     Barry Rowlingson's draft Rmap package, and from Radim Blazek's
     v.in.ogr program in GRASS.

_A_u_t_h_o_r(_s):

     Roger Bivand

_R_e_f_e_r_e_n_c_e_s:

     <URL: http://www.remotesensing.org/gdal/ogr/index.html>, <URL:
     http://www.remotesensing.org/gdal/ogr/ogr_formats.html>, <URL:
     http://examples.oreilly.com/webmapping/>

_S_e_e _A_l_s_o:

     'SpatialPointsDataFrame-class', 'SpatialLinesDataFrame-class',
     'SpatialPolygonsDataFrame-class', 'readShapePoly'

_E_x_a_m_p_l_e_s:

     cities <- readOGR(system.file("vectors", package = "rgdal")[1], "cities")
     summary(cities)
     kiritimati_primary_roads <- readOGR(system.file("vectors", package = "rgdal")[1], "kiritimati_primary_roads")
     summary(kiritimati_primary_roads)
     scot_BNG <- readOGR(system.file("vectors", package = "rgdal")[1], "scot_BNG")
     summary(scot_BNG)
     places <- try(readOGR(system.file("vectors/places.gml", package = "rgdal")[1], "places"))
     if (class(places) != "try-error") summary(places)
     ps_cant_31 <- readOGR(system.file("vectors/ps_cant_31.MIF", package = "rgdal")[1], "ps_cant_31")
     summary(ps_cant_31)
     Up <- readOGR(system.file("vectors/Up.tab", package = "rgdal")[1], "Up")
     summary(Up)

