[R-sig-Geo] How do I use neighbourhood list to recursively merge adjacent polygons

christiaan pauw cjpauw at gmail.com
Tue Sep 7 12:42:18 CEST 2010


Hallo Everybody

I have a SpatialPolygonsDataFrame where residential stands in a town
are given as polygons.  The streets are "represented" by the empty
space between the polygons. I want to dissolve the stand boundaries
within a street block to get just the outer extent of a street block.
My aim is this to move from a map of individual houses to a map of
street blocks.

The criterion for merging is that they touch an neighbouring polygon
(queen). Merging should continue until there are no polygons left
touch each other i.e until you only have the street blocks separated
by the empty space where the streets are.  I have tried to use
unionSpatialPolygons but have not found a way in which is can define
which polygons to merge since I do not know how to define the "IDs"
argument correctly. I had a feeling that I could specify which
polygons to merge with poly2nb but poly2nb does not work recursively -
i.e. the same polygon can be found in more than one entry on the nb
list.

I was also looking for a data set to build a self-contained example
with (like a map of the world where one can dissolve the country
boundaries and end up only with continents) but could not find one

Can anyone offer me some advice
Regards
Christiaan



More information about the R-sig-Geo mailing list