[R-sig-Geo] Eliminate duplicate vertices in a SpatialPolygonsDataFrame object

Don MacQueen macq at llnl.gov
Sat Jun 16 02:51:57 CEST 2007


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.

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.

Thanks
-Don
-- 
--------------------------------------
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA




More information about the R-sig-Geo mailing list