[R] build a SpatialLines object from a list

Ashraf Afana asafaneh at yahoo.com
Mon Sep 25 14:40:43 CEST 2017


Hi all,I'm trying to build a SpatialLines object from a list that contains 124 river segments. Each segment in the list contains the x,y coordinates. I'm using the following code to create the SpatialLines object, but it just retrieves one segment. Any suggestions?

test.func = function(x){
     for (i in 1:length(x)) {        tt[[i]] <- x[i]; tt[[i]]  = Line(tt[[i]]); tt[[i]]  = Lines(list(tt[[i]] ), 'i')        tt1 = SpatialLines(list(tt[[i]]))           }    return(tt1)  }
Ashraf,
	[[alternative HTML version deleted]]



More information about the R-help mailing list