Does there already exist a function in R to identify intersection between pairs of points?
This post has NOT been accepted by the mailing list yet.
I am looking to find if two lat/lon points collected from a radio collared animal intersect a road. The current data I am working with consists of
1) road points converted from road layers using fortify() function in library
2) GPS radio lat/lon locations.
Given two pairs of points, is there a predefined function in R that will tell if the straight lines connecting each pair intersect? I have written my own function for this purpose and was wondering if it would be worth it to develop this into a package.
For example, say I want to know if the line segments defined by
Then intersecting the two SpatialLines can be done using the rgeos package and gIntersection function. The output will be the SpatialPoints (Coordinates) where the collar fix segments and roads intersect (representing presumably road crossing areas?), which you can map.
Lecturer in GeoInformatics
Department of Geography & Sustainable Development
University of St Andrews, UK