Hi Roger
I'm just getting around to trying this out.
I must say, I'm not clear on how to work with the neighbour list object
to accomplish this. Specifically, how would I identify the largest
neighbours of the sliver candidates?
Furthermore, do I first subset the polygons according to the area
threshold, and then construct the neighbour list for only these
candidate slivers? I'm not clear on how to identify neighbours for a
subset of polygons.
Sorry to bother you with this again. It will be very useful if it works
as I would also like to use it for region merging based on other attributes.
Still waiting on that book...!
Murray
Roger Bivand wrote:
On Wed, 13 Aug 2008, Murray Richardson wrote:
Hello again r.sig.geo list,
Thanks Roger, for help on my previous question regarding iterating
through a shapefile.
I'm sure once I receive my copy of "Applied Spatial Data Analysis
with R" I will find answers to simple questions like this on my own,
but in the meantime....
Is it possible to merge sliver polygons that fall below a certain
threshold area with adjacent neighbours (e.g. perhaps using
unionSpatialPolygons but without aggregating any polygons?). If a
sliver shares edges with more than one polygon, it doesn't really
matter which one it merges with, but if I had to choose a rule I
would have it merge with the largest one.
Not such a simple question ...
Both the Polygon and Polygons objects in the SpatialPolygons object
have "area" slots, with different roles. The Polygon objects have a
correct naive area in the geometry of the coordinates taken as planar.
The Polygons objects use the "gross" area of Polygon objects belonging
to them, but "only" to provide the plot order (plot from largest to
smallest to avoid over-painting).
If you "trust" the area slot of the Polygons objects (beware of hole
Polygon objects), you can first find your candidate slivers by
retrieving the areas by:
Polygons_areas <- sapply(slot(SPobj, "polygons"),
function(x) slot(x, "area"))
and set a cutoff. Then use poly2nb(SPobj, queen=FALSE) in spdep to
find the neighbours (rook criterion). Next use the output object to
identify the largest neighbours of the sliver candidates, and build a
"new Polygons" ID vector. Finally, use unionSpatialPolygons(). I'm
assuming you wouldn't have asked if there was useful data in the slivers!
Hope this helps,
Roger
Thanks in advance,
Murray Richardson
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo