On Wed, 17 Feb 2010, Michael Sumner wrote:
flop<-Lines(Line(list(rbind(as.numeric(temp[1,7:8]),
as.numeric(temp[1,9:10], ID=row.names(temp))
I think that there is a misplacement too:
flop <- Lines(list(Line(rbind(as.numeric(temp[1,7:8]),
as.numeric(temp[1,9:10], ID=row.names(temp))
>> flop<-Lines(Line(list(rbind(as.numeric(temp[1,7:8]),
> as.numeric(temp[1,9:10], ID=row.names(temp))
>> SpatialLines(flop)
> Error in as.list.default(X) :
> no method for coercing this S4 class to a vector
>
You need to put "flop" in a list of its own, as SpatialLines is a
collection class
Much thanks to all for these useful and informative responses.
I had come across the book in my searches but I had not stumbled onto its
homepage with the additional resources Roger has provided, which are
indispensable. Perhaps to circumvent the potential conflict of interest you
could add a URL
On Mon, 15 Feb 2010, Tyler Dean Rudolph wrote:
I have searched extensively for some good examples or documentation on how
to create a SpatialLinesDataFrame and for the life of me have found zilch.
This does not mean there is no such thing available, it just means that
wherever it is it is not re
Using apply makes it difficult to set an appropriate ID for each Line,
so I've done it in a loop:
ranlines <- list()
for (irow in 1:nrow(temp)) {
ranlines[[irow]] <- Lines(Line(rbind(as.numeric(temp[irow, c("x",
"y")]), as.numeric(temp[irow, c("X2", "Y2")]))),
ID = as.char
I have searched extensively for some good examples or documentation on how
to create a SpatialLinesDataFrame and for the life of me have found zilch.
This does not mean there is no such thing available, it just means that
wherever it is it is not readily accessible through the circuitous pathways
o