[R-sig-Geo] How to establish location of points relative to a line

Roger Bivand Roger.Bivand at nhh.no
Fri Oct 10 19:50:56 CEST 2008


On Fri, 10 Oct 2008, Barry Rowlingson wrote:

> 2008/10/10 Bjarke Christensen <Bjarke.Christensen at sydbank.dk>:
>> Hi,
>>
>> I have a SpatialLinesDataFrame (A) and a SpatialPointsDataFrame (B). How
>> can I establish which points in B are to the east of a given line in A?
>>
>> The problem is to figure out which persons (whose addresses are geocoded in
>> B) have addresses to the east of a given road (whose coordinates are given
>> in A).
>
> Is this problem well-defined for a wiggly road? You could be both
> east and west of a particularly curvy road.
>
> You could take the nearest point of the road to the address location
> and then see if this vector has a positive or negative X component....

Perhaps you could consider completing a polygon with the road on the 
"west" edge, for your definition of "west", for example adding the south. 
east and north edges of the bounding box of the points to the line (take 
care over ring direction!). Then the overlay method would get you there.

Roger

>
> And of course it would be a trivial problem in New York (except for 
> Broadway!).
>

PS: or Wall St., here today, gone tomorrow?

> Barry
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no




More information about the R-sig-Geo mailing list