[R-sig-Geo] Neighbor matrix from shp file
Barry Rowlingson
b.rowlingson at lancaster.ac.uk
Tue May 11 22:24:17 CEST 2010
On Tue, May 11, 2010 at 9:10 PM, Peter Larson <pslarson2 at gmail.com> wrote:
> Hello,
>
> I have a shp file of polygons of US counties and want to generate an
> adjacency matrix (neighbor matrix).
>
> Is there an easy way to do this? It seems like it should be trivial.
poly2nb in the spdep package will produce a list of adjacencies, and
from that you can make a full adjacency matrix if you want, but it
will probably be very sparse.
However... polygons that look adjacent might be very very close and
not found as adjacent by poly2nb. I'm investigating this with some of
my data at the moment...
Barry
More information about the R-sig-Geo
mailing list