Problem using ?# with polygon

Started by Pierre-Yves LANDUREover 23 years ago2 messagesgeneral
Jump to latest
#1Pierre-Yves LANDURE
pylandur@ifremer.fr

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é

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Pierre-Yves LANDURE (#1)
Re: Problem using ?# with polygon

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