[R-sig-Geo] Extracting "lines" from ArcGIS file
b.rowlingson at lancaster.ac.uk
Fri Jan 28 15:42:36 CET 2011
On Fri, Jan 28, 2011 at 1:03 PM, Christian Paroissin
<christian.paroissin at univ-pau.fr> wrote:
> I have downloaded an Arcgis file here:
> I would like to extract informations from these dataset. It gives an S4
> object but I know nothing about it. Here is the code I wrote:
> object1.shp <- readShapeSpatial("Cours-AG/COURS_D_EAU.shp")
> index= which(object1.shp$TOPONYME=="L'Adour")
> I would like to extract the 'information' called "lines" but I don't known
> how do it. I find how to extract the 'information' "bbox"
> Could you help me please?
> Do "lines" correspond to the coordinates of the different points defining
> the river ("L'Adour" in my case)?
Yes. but rivers are never simple. The data structure is therefore complex :)
object1.shp is a SpatialLinesDataFrame. Its a bit like a dataframe,
but with a geometry for each row. Each row is a 'feature' - not
necessarily a single wiggly line, it could be several lines. In your
case it seems there is one of everything, so you can do:
to get a 2-column matrix of the coordinates of that feature.
See the help for SpatialLinesDataFrame and the vignette for the sp
package and the ASDAR book for more.
More information about the R-sig-Geo