Skip to content
Prev 2232 / 29559 Next

distmap

I've tried (among other things):
 > limit1 <- read.shape("limit_PNSN2000.shp")
Shapefile type: Polygon, (5), # of Shapes: 2
 > limit1poly <- Map2poly(limit1)
 > limit1owin <- as(limit1poly,"owin")
Error in .classEnv(thisClass) : unable to find an environment containing 
class "polylist"

 > limit2 <- readOGR("limit_PNSN2000.shp",layer="limit_PNSN2000")
OGR data source with driver: ESRI Shapefile
Source: "limit_PNSN2000.shp", layer: "limit_PNSN2000"
with  2  rows and  1  columns
 > limit2poly <- Map2poly(limit1)
 > limit1owin <- as(limit2poly,"owin")
Error in .classEnv(thisClass) : unable to find an environment containing 
class "polylist"
 > limit1owin <- as(limit2,"owin")
Error in as.owin.SpatialPolygons(from) : W must be a SpatialPolygons object

I guess all I need is to convert my shapefile (read into R via 
read.shape or readOGR?) into an object like letterR:

 > data(letterR)
 > str(letterR)
List of 4
  $ type  : chr "polygonal"
  $ xrange: num [1:2] 2.02 3.93
  $ yrange: num [1:2] 0.645 3.278
  $ bdry  :List of 2
   ..$ :List of 2
   .. ..$ x: num [1:24] 2.03 2.02 2.02 2.66 2.66 ...
   .. ..$ y: num [1:24] 3.278 3.248 0.653 0.653 1.695 ...
   ..$ :List of 2
   .. ..$ x: num [1:10] 2.65 2.64 3.04 3.12 3.16 ...
   .. ..$ y: num [1:10] 2.23 2.70 2.71 2.63 2.50 ...
  - attr(*, "class")= chr "owin"

but how can I do it?

Also, I'm so confused with so many spatial objects, is there a guide?

Agus

Roger Bivand escribi?: