On Mon, 26 Jul 2010, toby.patter...@csiro.au wrote:

Hi, Apologies up front if this has been covered somewhere already -- I have seen some discussion of a similar problem on the list, but it doesn't quite seem to cover what I'm after.

Also I'm new to the spatial side of R, so I might not quite use the correct lingo!

My problem is this:

For a set of polygons (a SpatialPolygonsDataFrame) with shared boundaries (i.e. with no overlapping regions or gaps between them), I need to know the length of shared adjacent boundaries. Note, in this case all polygons will have a boundary shared with at least one other polygon.

So I'm after a square symmetric matrix with diagonals zero. The i,j th entry would then be the length (in some appropriate coordinate system) of the boundary between polygon i and j.

Also - I'm not sure if sufficient information is stored in the SpatialPolygonsDataFrame class actually allow these shared lengths to be calculated. I'm sure someone can quickly clear that up for me. Possibly this can only be done in GIS systems?

Indeed, only in topological GIS, because the nodes and arcs must be identified and the topology built. The only provision in R-spatial is using vect2neigh() in the spgrass6 interface to GRASS6. You would need to install GRASS first, export the polygons to GRASS, then read off the neighbours and the boundary lengths with the function. As far as I'm aware, it doesn't work on Windows because of the inadequacy of cmd.exe (script variable quoting) for running v.db.addtable, but on other platforms works fine. The function is described in:

https://stat.ethz.ch/pipermail/r-sig-geo/2005-October/000616.html

and on its help page.

Hope this helps,

Roger


Any help would be much appreciated as this it seems quite a fiddly one to write myself.

Thanks,
Toby

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


--
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: roger.biv...@nhh.no

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to