Ich versuche, ein leeres SpatialLines-Objekt zu erstellen. Mit Polygonen ist es einfach:Erstellen Sie leere räumliche Linien Objekt
SpatialPolygons(list())
Für räumliche Linien funktioniert das nicht:
SpatialLines(LinesList = list())
Error in bb[1, ] : incorrect number of dimensions
SpatialLines(LinesList = Lines(list(),ID = "a"))
Error in as.list.default(X) :
no method for coercing this S4 class to a vector
SpatialLines(LinesList = Lines(slinelist = Line(coords = cbind(x = c(), y = c())), ID = c()))
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘coordinates’ for signature ‘"NULL"’
Weiß jemand, wie ich es könnte ein leeres SpatialLines Objekt erstellen?
Umgehung
fand ich eine Abhilfe, die es zu tun vielleicht nicht der beste Weg ist. Ich erzeuge eine räumliche Linie ohne Länge:
SpatialLines(list(Lines(Line(coords = cbind(x = c(0,0), y = c(0,0))), ID = "A")))