[postgis-users] Checking the point location against a line
Eric Randall
eprand at earthlink.net
Sun Apr 8 07:08:35 PDT 2007
from comp.graphics.algorithms:
if your polyline goes from A to B and your point is P, you can use this
formula:
v = (Ay-By)*Px+(Bx-Ax)*Py+(Ax*By-Bx*Ay)
v>0: "Left"
v<0: "Right"
v=0: "On the line" (or in front of B / behind A)
using this and x(),y(), startpoint(), and endpoint() functions you can
do it in your SQL statement i think.
-Eric
More information about the postgis-users
mailing list