This question assumes that I'm using R with the sp and rgdal packages installed. Now that I have a set of spatial segments of class SpatialLinesDataFrame (called 'segmentData') and a set of spatial points of class SpatialPointsDataFrame (called 'poi'). Suppose that the segments and the points intersect each other as illustrated in the example figure below where line segments are in red and POIs are in blue. I'm trying to query using the function 'over' of the sp package in order to find out which lines cross over a given point. I'm having the following 2 problems:
(1) Whenever I try to query using over(poi, segmentData) or over(segmentData, poi), the returned result is always a list of NA's. But apparently, they do intersect each other, as illustrated in the example. How do I get a valid returned list?
(2) The 'over' method only returns one line id that intersects a given POI (if any), but apparently given one POI there could be several segments that cross over it (e.g., POI located at intersection of 2 road segments). How do I query so that for a given POI, I wish to find all the segments that cross over it?