----------------------------------------------------------------------
Message: 1
Date: Sat, 02 May 2009 22:52:36 -0500
From: Jim Burke <[email protected]>
Subject: [R-sig-Geo] How can I convert a "SpatialPolygons" object to a
"polylist"?
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
How can I convert a "SpatialPolygons" object to a "polylist"
I have a file read in with "readShapePoly". This contains the polygon
long lats in a slot called "coords". I want to use the package "splancs"
"inout" function which works according to the doc with polygon data sets.
An example Map2Poly which works with "inout" lists itself as a class
"polylist".
Thanks,
Jim Burke
if your SpatialPolygons name is e.g. myObject
lapply(myobj...@polygons, function(x) x...@polygons[[1]]@coords)
should make it in the very simple case (the most common too anyway)
where each attribute line corresponds to one single polygon. It will
provide you with a list whose elements will be the coordinates of each
polygon.
More complex cases are a bit more difficult to handle
Patrick
_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo