[postgis-users] Left of/Right of test

Denis Rouzaud denis.rouzaud at gmail.com
Tue Jul 23 07:31:56 PDT 2013


Hi Andreas,

Do you mean you want to test to a segment?

Because, I can't see a true answer for a line.

If you want to do test to a segment, it should do the job to test if the 
intersection with the horizontal line (dy=0) over your point and your 
input line is on the left/right to your point.

So, maybe test:

pointGeom << ST_Intersection( ST_MakeLine(
             ST_MakePoint(ST_XMin(lineGeom), ST_Y(pointGeom)),
             ST_MakePoint(ST_XMax(lineGeom), ST_Y(pointGeom))
                                                                )

You have to handle the case where your segment is horizontal, but then a 
simple test with ST_Xmin/max should be enough.

Cheers,

Denis

On 07/23/2013 03:54 PM, Andreas Neumann wrote:
> Hi,
>
> I want to test a point if it is left-of or right-of a given LINESTRING.
> I found the << >> and &< &> but they do not behave like I expected.
>
> Perhaps it is because they only test on the bounding box level and not
> on the real geometry?
>
> Is there a left/right of test available on the geometry instead of the
> bounding box?
>
> Thank you,
> Andreas
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users



More information about the postgis-users mailing list