Re: Problem using ?# with polygon - Mailing list pgsql-general

From Tom Lane
Subject Re: Problem using ?# with polygon
Date
Msg-id 12286.1027086152@sss.pgh.pa.us
Whole thread Raw
In response to Problem using ?# with polygon  (Pierre-Yves LANDURE <pylandur@ifremer.fr>)
List pgsql-general
Pierre-Yves LANDURE <pylandur@ifremer.fr> writes:
> i'm trying to intersect a box and a polygon with ?#.. but the polygon
> seems to be automaticaly converted to a box.... so that the given result
> is false

Not surprising considering the lack of any ?# for polygons.

regression=# \do ?#
                           List of operators
 Name | Left arg type | Right arg type | Result type |   Description
------+---------------+----------------+-------------+------------------
 ?#   | "path"        | "path"         | boolean     | paths intersect?
 ?#   | box           | box            | boolean     | overlaps
 ?#   | line          | box            | boolean     |
 ?#   | line          | line           | boolean     | lines intersect?
 ?#   | lseg          | box            | boolean     | intersects?
 ?#   | lseg          | line           | boolean     |
 ?#   | lseg          | lseg           | boolean     | intersect?
(7 rows)

Perhaps you could coerce both to paths and look at whether the distance
(<-> operator) is zero.  Not sure whether that gives quite the result
you want though.

Other alternatives: (a) write and contribute an intersection function
for point and polygon; (b) take a look at PostGIS which probably does
what you want already.

            regards, tom lane

pgsql-general by date:

Previous
From: Oliver Elphick
Date:
Subject: Re: Looking for types: phone number, email addresses
Next
From: Tom Lane
Date:
Subject: Re: COMMIT in PostgreSQL