Skip to content

How extract the names of ID in SpatialPolygons object

2 messages · fernando espindola, Roger Bivand

#
On Fri, 30 Dec 2005, fernando espindola wrote:

            
The most generic way is to extract the "polygons" slot from your object 
and then the "ID" from each member "Polygons" in turn - using sapply 
because you want a character vector returned, one ID for each list member:

sapply(slot(mySpatialPolygons, "polygons"), function(x) slot(x, "ID"))

but there is an access function too:

getSpPPolygonsIDSlots()

which is just the above with a name.

Roger