[R-sig-Geo] Eliminate duplicate vertices in a SpatialPolygonsDataFrame object
Roger.Bivand at nhh.no
Sat Jun 16 22:06:29 CEST 2007
On Fri, 15 Jun 2007, Don MacQueen wrote:
> I have managed to create several SpatialPoygonsDataFrame objects in
> which the polygons have duplicate vertices. That is, there are
> duplicate rows in the matrix in "coords" slot of the object.
> In most cases, the object has just one polygon, but in at least one
> case it has an outer polygon and a hole.
> I would really appreciate some suggestions about an efficient way to
> remove duplicate rows from the matrix containing the polygon vertices.
Do you know that the duplicate rows are next to each other, and that the
distance between them is effectively equal to zero? If so, then perhaps
you could provide a (subset) example, perhaps as an attached *.rda file
> I have a solution using an application called Quantum GIS (the same
> app I used to create the duplicate rows without realizing it!), but
> it's rather awkward and tedious. Surely I can do better in R, but I
> haven't managed to learn yet how to extract, edit, update the
> contents of the coords slots (especially if there's more than one, as
> in a hole).
> Any ideas would be very welcome.
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.Bivand at nhh.no
More information about the R-sig-Geo