Skip to content
Prev 6994 / 29559 Next

Map labels

On Mon, 23 Nov 2009, tom sgouros wrote:

            
Yes, see the unionSpatialPolygons() function in maptools. It uses 
functions in gpclib to dissolve boundaries between member entities if they 
touch, so makes a Polygons object with possibly multiple member Polygon 
objects from multiple Polygons objects with the same ID values (towns for 
you). You then need to drop rows from the data.frame (as(rep.map, 
"data.frame")), and re-assemble using SpatialPolygonsDataFrame() with the 
row.names of the data.frame set to the town IDs used in 
unionSpatialPolygons().

The mess is caused by the underlying data being kept in OGC SFS (simple 
features) form, which does not store well in shapefiles (a similar remark 
could be made about SpatialPolygons objects, which are more like 
shapefiles than like SFS).

The gpclib package should not be used if its license conditions are
inappropriate. A free software alternative is being prepared.

Roger