On 12/16/2012 08:58 PM, Barry Rowlingson wrote: > On Sun, Dec 16, 2012 at 6:53 PM, Chris English <sgl...@hotmail.com> wrote: >> >> Edzer: >> On Tue, Jul 17, 2012 at 2:34 PM, Agustin Lobo ~ from Barry Rowlingson >> wrote: >> To convert to SpatialLines, get the coordinates and build in the >> usual convoluted manner: >> >> > s=data.frame(x=runif(10),y=1:10,z=rnorm(10)) >> > coordinates(s)=~x+y >> > L = SpatialLines(list(Lines(list(Line(coordinates(s))),"X"))) >> > plot(L) >> Convoluted is not the same as orphaned, certainly, but one gets the sense >> that >> 'Line' owes its existence to matters of plotting rather than line as line, >> independent of >> drawing it, and this may have some import upon line analysis and the >> possibility of >> arriving at topology and dispensing with shared lines and the like. > > "Line" is a non-spatial Line, made up from an ordered set of (x,y) > coordinate pairs. It cannot have a coordinate system assigned to it. > > "Lines" is a list of Lines, making a non-spatial set of Line > segments. It too cannot have a coordinate system assigned. > > "SpatialLines" is a spatial set of Lines, for when you have a number > of features each of which may be composed of several disconnected > segments. It can have a coordinate system assigned. > > You are making a SpatialLines object where a single feature has a > single line segment. The slightly annoying > list(Lines(list(Line(...)))) dance is unavoidable because the lists > are necessary since the lists can have more than one element, but you > could easy create a 'SimpleSpatialLine' function that did all that. It > might even make sp for R 3.0.0! (SimpleSpatialPolygon might be handy > too...)
Nice idea -- or a "simple" method that does it with whatever you feed it with? Or simply "c" methods, like c(Line1,Line2,Line3) creating a SpatialLines object? @Chris: the convolution of lines is identical to that of polygons, as is its lack of topology and facilities for analysis. > > Another possibility might be to write methods for SpatialLines that > takes a matrix and skips the complexity for simple cases... like, a n x 2 matrix with NA-separated lines? > > Barry > -- Edzer Pebesma Institute for Geoinformatics (ifgi), University of Münster Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251 8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de http://www.52north.org/geostatistics e.pebe...@wwu.de _______________________________________________ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo