Dear all , I have a problem in converting some interpolated contourLines into SLDF, using the function ContourLines2SLDF. I tried with the example given in "Applied Spatial Data Analysis wit R", but for similar input data, the function returns a strange SLDF with my data... I am then unable to check for equality between first and last coordinates (suitable to create polygons).. Does someone know what's wrong with my code?? Many thanks for your help!
library(maptools) load("XXX/interpolated_den.Rdata") ## the data is called DDD... AA<-contourLines(DDD,levels=c(2)) ## I keep only the isolines of level 2 test<-ContourLines2SLDF(AA) ## library(maptools) transforme les isolignes en SpatialLinesDataFrame lns<-slot(test,"lines") # as in the ASDAR p. 48 table(sapply(lns,function(x) length(slot(x,"Lines")))) ## return 28/1 rather that 1/28 -> lns is a list 1 object composed of 28 lines, rather than being a list of 28 object of 1 lines.... ## thus I can't do the next step... table(sapply(lignes, function(x) { coord<-slot(slot(x,"Lines")[[1]],"coords") identical(coord[1,],coord[nrow(coord),])})) ___________________________________________________________ Ervan Rutishauser PhD student CIRAD - UMR AMAP BP 701 97387 Kourou Cedex tel. 00594.594.32.92.96
interpolated_den.Rdata
Description: interpolated_den.Rdata
_______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo