[R-sig-Geo] distmap

Roger Bivand Roger.Bivand at nhh.no
Tue Jun 26 11:36:24 CEST 2007


On Mon, 25 Jun 2007, Edzer J. Pebesma wrote:

> 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.

In principle yes, especially with fresh sp and maptools, but I'm not sure 
that my code in earlier versions allowed inheritance properly, and we 
don't know which package versions are being used. Hence the general 
request to state sessionInfo() output in all questions to the list.

Roger

> --
> Edzer
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no




More information about the R-sig-Geo mailing list