[R-sig-Geo] subsetting a WKT Multilinestring

Edzer Pebesma edzer.pebesma at uni-muenster.de
Mon Apr 22 20:25:33 CEST 2013



On 04/22/2013 07:04 PM, Philip A. Viton wrote:
> Consider:
> 
> library(rgeos)
> mls<-readWKT("MULTILINESTRING((3 4, 10 50, 20 25),(30 30, 70 50, 24 55)
>              ,(30 12, 50 5, 65 7))")
> 
> mls is, as expected, a SpatialLines object, and
> plotting it shows that indeed it has three individual
> lines. My question is: is there some way to subset this
> object so as to obtain a smaller SpatialLines object?
> (say, by excluding the second Line)?

They're considered as a single line; try length(mls).

If somebody comes up with a simple function to do this, and a similar
thing for polygons, and we can agree on a name for such a thing
(unfold?) I'm willing to consider it for sp. Or is it already somewhere?

> 
> ------------------------
> Philip A. Viton
> City Planning, Ohio State University
> 275 West Woodruff Avenue, Columbus OH 43210
> viton.1 at osu.edu
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

-- 
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.pebesma at wwu.de



More information about the R-sig-Geo mailing list