Thread: Problem using ?# with polygon

Problem using ?# with polygon

From
Pierre-Yves LANDURE
Date:
Hi, i've got a problem

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

is there a solution to make the polygon really intersect whith the box ?

thx for your help.

Pierre-Yves Landuré


Re: Problem using ?# with polygon

From
Tom Lane
Date:
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