[R-sig-Geo] Order a SpatialLine passes through a SpatialPolygons
jthayn at ilstu.edu
Thu Aug 31 22:06:57 CEST 2017
I’m trying to write a function that returns the polygons through which a line passes, but I want the polygons to be listed in order. For example, in the code below, I get a list of polygons over which the lines passes, but the polygons are listed in numeric order, not spatial order. I would like the polygons to be listed as 21, 24, 25, 26, and 22 (the reverse would be fine to). Any ideas.
coords <- coordinates(columbus)
the.line <- SpatialLines(list(Lines(Line(coords[c(21,22),]),ID="A")))
Jonathan B. Thayn, Ph.D.
Department of Geography – Geology
Illinois State University
Felmley Hall of Science, Rm 200A
Normal, IL 61790
jthayn at ilstu.edu<mailto:jthayn at ilstu.edu>
[[alternative HTML version deleted]]
More information about the R-sig-Geo