Hi,

Thanks to everyone on this list. It is a true source of help!

I'm reading huge shapefiles like this:

shp_0 <- rgdal::readOGR(dsn="dir", layer="TheLayer")

There are two columns in the shp_0@data: bin1 and bin2.

I need to get a table with three columns: id, X, Y.

First I do this:
shp_0@data$id = rownames(shp_0@data)

When I then run this:
tbl_coords <-fortify.SpatialPolygonsDataFrame(shp_0)
I get: "Using bin1 to define regions.
Error in createPolygonsComment(p) :
  rgeos_PolyCreateComment: orphaned hole, cannot find containing polygon
for hole at index 3"

After reading in previous messages on this email-list, I tried:

slot(shp_0, "polygons") <- lapply(slot(shp_0, "polygons"),
checkPolygonsHoles), which proceeds to a new R-prompt with no issue
mentioned.

But everytime I then run
shp_1 <- unionSpatialPolygons(shp_0, as.character(shp_0$id))
I get another crasch:
"This application has requested the Runtime to terminate it in an unusual
way.
Please contact the application's support team for more information."

How can I get the coordinates per polygon in one large table? I know how to
get them per polygon, but to rbind more than 30 000 polygons take forever.
To get the areas is easy "sapply(shp_0@polygons, function(x) x@area)", but
the coords are deeper into the sp-object and I don't know how to "apply-it
out".

Thank you very much for all help.

/Chris

	[[alternative HTML version deleted]]

