[R-sig-Geo] Determine if a line segment intersects a polygon

GREGOR Brian J Brian.J.GREGOR at odot.state.or.us
Sun Aug 12 19:29:12 CEST 2007


> I am looking for a method that would determine whether any part of a
> line segment defined by (x0, y0) and (x1, y1) intersects a 
> given polygon
> (true or false).  I don't have any other geospatial needs 
> here, so if a
> solution exists using base R that would be great.

I had to do something similar and used the "crossing.psp" function in
the "spatstat" package. It determines the crossing points of two sets of
line segments. You will need to convert the line segments describing the
polygon boundary into a line segment pattern of class "psp" used by
"spatstat".

Brian Gregor, P.E.
Transportation Planning Analysis Unit
Oregon Department of Transportation
Brian.J.GREGOR at odot.state.or.us
(503) 986-4120




More information about the R-sig-Geo mailing list