Jonathan Greenberg wrote: > R-sig-geo'ers: > > I'm pushing forward with recoding starspan as a set of R functions so > we can get the program back on track after a long hiatus with the > development of a C version (I don't know C and don't have time to learn > it, and we lost our master programmer who did know C), and I'm trying to > decide if I should allow the vector side of the program to specifically > require shapefiles, or to allow it to be more flexible and allow any > type of ogr-readable file. Here are a couple of questions: > > 1) Is there a command to dump the database(s) of any ogr file to a > dataframe, regardless of the data type? Right now, all I have found is > that I need to use the read.dbf() function in the shapefiles library for > a shapefile-associated DBF. > 2) Is there any way to figure out the particular driver (aka file type) > of a file I'm trying to read with ogr without needing the layer name? > Alternatively, is there any way to list the layer names of an ogr file? > > Thanks -- I'm going to try to make a release of starspan in the next > few weeks to have people try it out... > > --j >
Jonathan, 1.If you read the ogr layer in with the Rgdal package then you can easily extract the dataframe from the spatial object. library(rgdal) layer1 <- readOGR("/home/madadh/ucd/geo290-sp09/client/data/joined.shp","joined") dataframe1 <- lay...@data 2. ogrInfo should have all the information you need you will need at least the connection string/path to the source to use it though, aka DSN according to ogr/gdal documentation. You'll just need to parse it's output to grab the pieces for other commands. Alex _______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo