[postgis-users] Checking the point location against a line
Pedro Doria Meunier
pdoria at netmadeira.com
Fri Apr 6 21:18:59 PDT 2007
Hey G. Lu,
This is best accomplished programmatically (at least from where I stand :])
LatLon is your friend here
. (coords are returned as (+-)99.999999)
To determine if the point is above the line Ive already shown you
About up, down, left, right
.
You can extract a single point from the line with pointn(geometry,1)
(points start at 1 in line segs)
(should you want to debugvisually confirm cordsuse :
astext(pointn(geometry,1))
The flux for it is loosely this:
If (pointLon> Linepoint[1].Lon) then RIGHT;
Elseif (pointLon<Linepoint[1]Lon) then LEFT;
Elseif (pointLat>Linepoint[1].Lat) then UP;
Elseif (pointLat<Linepoint[1].Lat) then DOWN;
Else FREAKISH_CASE!:]
<Gurus>
Theres probably a more elegant way to do this in PL/SQL
</Gurus>
HTH,
Pedro.
From: ray at codemeit.com [mailto:ray at codemeit.com] On Behalf Of Ray G. Lu
Sent: sábado, 7 de Abril de 2007 3:05
To: Pedro Doria Meunier; postgis-users at postgis.refractions.net
Subject: Re: [postgis-users] Checking the point location against a line
Hello Pedro ,
Thanks for your reply,
What I meant was how to determine P(x0,y0)
is above the line or LEFT side of the line,
or P(x2,y2) is below the line or RIGHT side of the line.
################################################
P(x0,y0) Above the line
This is line
-------------------------------o-------------------------------------
P(x1,y1) On the line
P(x2,y2) Below the line
################################################
Thanks,
G. LU
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20070407/ec20368b/attachment.html>
More information about the postgis-users
mailing list