[R-sig-Geo] distmap

Edzer J. Pebesma e.pebesma at geo.uu.nl
Mon Jun 25 22:07:40 CEST 2007


Roger Bivand wrote:
> On Mon, 25 Jun 2007, Agustin Lobo wrote:
>
>> 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
>
> Then just:
>
> limit1owin <- as(limit2,"owin")
>
> ought to work with current maptools, or possibly coerce:
>
> limit1owin <- as(as(limit2, "SpatialPolygons"), "owin")
>
the latter form shouldn't be needed thanks to S4 inheritance.
--
Edzer




More information about the R-sig-Geo mailing list