I appreciate the "simple" explanation, which does make since. I am still unable, however, to access the "coords" matrices inside of the SpatialPolyons object. I'm sure that there is a simple way to do this, but I can't figure it out. If I open a shapefile using readOGR() what code to I use to access the node coordinates? Thanks again for your help.
Jon Thayn On Oct 13, 2008, at 2:33 PM, Roger Bivand wrote: > On Mon, 13 Oct 2008, Jonathan Boyd Thayn wrote: > >> I want to know the length of the shared border of neighboring >> polygons >> in a shapefile. I can use the slots () function to access the the >> "polyons" slot of the file, but I can't seem to create a list of the >> node coordinates of the polyon. Is there a way to do this easily? > > I imagine that you mean the end nodes of arcs with known left and > right neighbours? The actual ring coordinates are simply the > "coords" slots of each "Polygon" object in the list in the > "Polygons" slot of each "Polygons" object in the list in the > "polygons" slot of the SpatialPolygons object (for a very special > definition of "simple"). But they wouldn't help much, because you > need to build the topology first. If you have access to ArcGIS, you > can push the polygons out for Arc as a shapefile, convert them into > a coverage (if they build cleanly) and get the coverage back into R > using readOGR as both polygons and arcs: > > http://www.asdar-book.org/exercises.php?excode=3 > > and link therein. Getting the lengths from the arcs could use > SpatialLinesLengths() in sp, and add the values to the > SpatialLinesDataFrame; this function assumes planar coordinates at > present. The coverage2nb() would need gentle editing to return a > list of lengths in the same format as the nb object. > > If GRASS is OK, look at vect2neigh() in the spgrass6 package by > Markus Neteler - it does what you want if the topology builds > cleanly, and possibly not on all platforms. > > Hope this helps, > > Roger > > >> Thanks. >> >> >> Jonathan B. Thayn >> Ph.D. Candidate Geography and Remote Sensing >> University of Kansas >> 2101 Constant Avenue, Higuchi Hall, Rm 121 >> Lawrence, Kansas 66047-3759 >> [EMAIL PROTECTED] >> http://people.ku.edu/~jonthayn >> >> >> [[alternative HTML version deleted]] >> >> > > -- > Roger Bivand > Economic Geography Section, Department of Economics, Norwegian > School of > Economics and Business Administration, Helleveien 30, N-5045 Bergen, > Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 > e-mail: [EMAIL PROTECTED] [[alternative HTML version deleted]]
_______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo