[R-sig-Geo] conversion to polygons

Luis Ridao Cruz Luisr at frs.fo
Mon Jun 19 11:27:11 CEST 2006


This gives still an error message:

test2 <- SpatialPolygons(list(Polygons(list(test)),ID=1)))

Error: syntax error in
"SpatialPolygons(list(Polygons(list(Polygons(coraltest))),ID=1)))"


Luis



>>> Roger Bivand <Roger.Bivand at nhh.no> 16/06/2006 09:41:54 >>>
On Wed, 14 Jun 2006, Luis Ridao Cruz wrote:

> R-Sig-Geo help,
> 
> I have an objct of class "SpatialPointsDataFrame"
> which I woul like to convert to polygon.
> 
> I have used the following:
> 
> test1<-Polygon(test)
> test2<-SpatialPolygons(list(test),1)

test2<-SpatialPolygons(list(Polygons(list(test)),ID=1)))

should do it - there are two layers, because some "Polygons" objects
with 
a single ID can have multiple "Polygon" object members.

Roger

> plot(test2,col=2,pbg="white")
> 
> but I get en error message like this:
> 
> Error in as.list(X) : cannot get a slot ("Polygons") from an object
of
> type "double"
> 
> I also try ploting:
> 
> plot(test1)
> 
> which gives :
> 
> Error in plot.window(xlim, ylim, log, asp, ...) : 
>         need finite 'xlim' values
> In addition: Warning messages:
> 1: no non-missing arguments to min; returning Inf 
> 2: no non-missing arguments to max; returning -Inf 
> 3: no non-missing arguments to min; returning Inf 
> 4: no non-missing arguments to max; returning -Inf 
> 
> 
> 
> 
> Thank you in advance
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch 
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo 
> 

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