pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #5889: "Intersects" for polygons broken
7+ messages / 4 participants
[nested] [flat]

* BUG #5889: "Intersects" for polygons broken
@ 2011-02-16 10:58  Konrad Garus <konrad.garus@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Konrad Garus @ 2011-02-16 10:58 UTC (permalink / raw)
  To: pgsql-bugs


The following bug has been logged online:

Bug reference:      5889
Logged by:          Konrad Garus
Email address:      konrad.garus@gmail.com
PostgreSQL version: 8.4
Operating system:   Linux
Description:        "Intersects" for polygons broken
Details: 

&& operator seems to be broken for polygons whose bounding boxes intersect:

select polygon'((0,0), (1,2), (0,2))' && polygon'((0.5, 0), (1,0), (1,1))';
 ?column? 
----------
 t
(1 row)

It reportedly is different in 9.0
(http://stackoverflow.com/q/5015233/277683)

Docs could do better job explaining what types each of the geometry operator
supports, and whether intersecting polygons support nonconvex polygons as
well, or only uses bounding box as criteria.



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: BUG #5889: "Intersects" for polygons broken
@ 2011-02-16 15:31  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Konrad Garus <konrad.garus@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Tom Lane @ 2011-02-16 15:31 UTC (permalink / raw)
  To: Konrad Garus <konrad.garus@gmail.com>; +Cc: pgsql-bugs

"Konrad Garus" <konrad.garus@gmail.com> writes:
> && operator seems to be broken for polygons whose bounding boxes intersect:

> select polygon'((0,0), (1,2), (0,2))' && polygon'((0.5, 0), (1,0), (1,1))';
>  ?column? 
> ----------
>  t
> (1 row)

This is fixed as of 9.0; see the release notes at
http://www.postgresql.org/docs/9.0/static/release-9-0.html
which say

	Correct calculations of "overlaps" and "contains" operations for polygons (Teodor Sigaev)

	The polygon && (overlaps) operator formerly just checked to see
	if the two polygons' bounding boxes overlapped. It now does a
	more correct check. The polygon @> and <@ (contains/contained
	by) operators formerly checked to see if one polygon's vertexes
	were all contained in the other; this can wrongly report "true"
	for some non-convex polygons. Now they check that all line
	segments of one polygon are contained in the other.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: BUG #5889: "Intersects" for polygons broken
@ 2011-02-16 15:33  Konrad Garus <konrad.garus@gmail.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 7+ messages in thread

From: Konrad Garus @ 2011-02-16 15:33 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs

2011/2/16 Tom Lane <tgl@sss.pgh.pa.us>:
> "Konrad Garus" <konrad.garus@gmail.com> writes:
>> && operator seems to be broken for polygons whose bounding boxes intersect:
>
>> select polygon'((0,0), (1,2), (0,2))' && polygon'((0.5, 0), (1,0), (1,1))';
>>  ?column?
>> ----------
>>  t
>> (1 row)
>
> This is fixed as of 9.0; see the release notes at
> http://www.postgresql.org/docs/9.0/static/release-9-0.html
> which say
>
>        Correct calculations of "overlaps" and "contains" operations for polygons (Teodor Sigaev)
>
>        The polygon && (overlaps) operator formerly just checked to see
>        if the two polygons' bounding boxes overlapped. It now does a
>        more correct check. The polygon @> and <@ (contains/contained
>        by) operators formerly checked to see if one polygon's vertexes
>        were all contained in the other; this can wrongly report "true"
>        for some non-convex polygons. Now they check that all line
>        segments of one polygon are contained in the other.

Thank you. How about the point of more informative docs that would
explain supported types, automatic conversions and all such caveats
(also for 8.3 and 8.4)?

-- 
Konrad Garus



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: BUG #5889: "Intersects" for polygons broken
@ 2011-03-08 19:41  Robert Haas <robertmhaas@gmail.com>
  parent: Konrad Garus <konrad.garus@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Robert Haas @ 2011-03-08 19:41 UTC (permalink / raw)
  To: Konrad Garus <konrad.garus@gmail.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-bugs

On Wed, Feb 16, 2011 at 10:33 AM, Konrad Garus <konrad.garus@gmail.com> wrote:
> 2011/2/16 Tom Lane <tgl@sss.pgh.pa.us>:
>> "Konrad Garus" <konrad.garus@gmail.com> writes:
>>> && operator seems to be broken for polygons whose bounding boxes intersect:
>>
>>> select polygon'((0,0), (1,2), (0,2))' && polygon'((0.5, 0), (1,0), (1,1))';
>>>  ?column?
>>> ----------
>>>  t
>>> (1 row)
>>
>> This is fixed as of 9.0; see the release notes at
>> http://www.postgresql.org/docs/9.0/static/release-9-0.html
>> which say
>>
>>        Correct calculations of "overlaps" and "contains" operations for polygons (Teodor Sigaev)
>>
>>        The polygon && (overlaps) operator formerly just checked to see
>>        if the two polygons' bounding boxes overlapped. It now does a
>>        more correct check. The polygon @> and <@ (contains/contained
>>        by) operators formerly checked to see if one polygon's vertexes
>>        were all contained in the other; this can wrongly report "true"
>>        for some non-convex polygons. Now they check that all line
>>        segments of one polygon are contained in the other.
>
> Thank you. How about the point of more informative docs that would
> explain supported types, automatic conversions and all such caveats
> (also for 8.3 and 8.4)?

I think a lot of these things are already documented.  Aren't they?

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: BUG #5889: "Intersects" for polygons broken
@ 2011-03-08 20:20  Konrad Garus <konrad.garus@gmail.com>
  parent: Robert Haas <robertmhaas@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Konrad Garus @ 2011-03-08 20:20 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-bugs

http://www.postgresql.org/docs/current/static/functions-geometry.html

I wish it explained what arguments each of the operators accepts, and
whether any automatic conversions take place (like polygon to box in
that 8.3 issue).

What happens when I call ?# or ?- on a polygon and point? Two points? Open path?

Some of these are obvious, but others not so much.

2011/3/8 Robert Haas <robertmhaas@gmail.com>:
> On Wed, Feb 16, 2011 at 10:33 AM, Konrad Garus <konrad.garus@gmail.com> wrote:
>> 2011/2/16 Tom Lane <tgl@sss.pgh.pa.us>:
>>> "Konrad Garus" <konrad.garus@gmail.com> writes:
>>>> && operator seems to be broken for polygons whose bounding boxes intersect:
>>>
>>>> select polygon'((0,0), (1,2), (0,2))' && polygon'((0.5, 0), (1,0), (1,1))';
>>>>  ?column?
>>>> ----------
>>>>  t
>>>> (1 row)
>>>
>>> This is fixed as of 9.0; see the release notes at
>>> http://www.postgresql.org/docs/9.0/static/release-9-0.html
>>> which say
>>>
>>>        Correct calculations of "overlaps" and "contains" operations for polygons (Teodor Sigaev)
>>>
>>>        The polygon && (overlaps) operator formerly just checked to see
>>>        if the two polygons' bounding boxes overlapped. It now does a
>>>        more correct check. The polygon @> and <@ (contains/contained
>>>        by) operators formerly checked to see if one polygon's vertexes
>>>        were all contained in the other; this can wrongly report "true"
>>>        for some non-convex polygons. Now they check that all line
>>>        segments of one polygon are contained in the other.
>>
>> Thank you. How about the point of more informative docs that would
>> explain supported types, automatic conversions and all such caveats
>> (also for 8.3 and 8.4)?
>
> I think a lot of these things are already documented.  Aren't they?
>
> --
> Robert Haas
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>



-- 
Konrad Garus



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: BUG #5889: "Intersects" for polygons broken
@ 2011-03-09 20:55  Robert Haas <robertmhaas@gmail.com>
  parent: Konrad Garus <konrad.garus@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Robert Haas @ 2011-03-09 20:55 UTC (permalink / raw)
  To: Konrad Garus <konrad.garus@gmail.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-bugs

On Tue, Mar 8, 2011 at 3:20 PM, Konrad Garus <konrad.garus@gmail.com> wrote:
> http://www.postgresql.org/docs/current/static/functions-geometry.html
>
> I wish it explained what arguments each of the operators accepts, and
> whether any automatic conversions take place (like polygon to box in
> that 8.3 issue).
>
> What happens when I call ?# or ?- on a polygon and point? Two points? Open path?
>
> Some of these are obvious, but others not so much.

Hmm, yeah.  That looks like it could be improved.  It's certainly not
obvious to me what box * point means, for example, even though the
description says scaling/rotation.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: BUG #5889: "Intersects" for polygons broken
@ 2011-03-11 15:20  Bruce Momjian <bruce@momjian.us>
  parent: Robert Haas <robertmhaas@gmail.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Bruce Momjian @ 2011-03-11 15:20 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: Konrad Garus <konrad.garus@gmail.com>; Tom Lane <tgl@sss.pgh.pa.us>; pgsql-bugs

Robert Haas wrote:
> On Tue, Mar 8, 2011 at 3:20 PM, Konrad Garus <konrad.garus@gmail.com> wrote:
> > http://www.postgresql.org/docs/current/static/functions-geometry.html
> >
> > I wish it explained what arguments each of the operators accepts, and
> > whether any automatic conversions take place (like polygon to box in
> > that 8.3 issue).
> >
> > What happens when I call ?# or ?- on a polygon and point? Two points? Open path?
> >
> > Some of these are obvious, but others not so much.
> 
> Hmm, yeah.  That looks like it could be improved.  It's certainly not
> obvious to me what box * point means, for example, even though the
> description says scaling/rotation.

Would someone who uses these features please post changes and I will see
that get into the docs?  Thanks.

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +



^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2011-03-11 15:20 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-02-16 10:58 BUG #5889: "Intersects" for polygons broken Konrad Garus <konrad.garus@gmail.com>
2011-02-16 15:31 ` Tom Lane <tgl@sss.pgh.pa.us>
2011-02-16 15:33   ` Konrad Garus <konrad.garus@gmail.com>
2011-03-08 19:41     ` Robert Haas <robertmhaas@gmail.com>
2011-03-08 20:20       ` Konrad Garus <konrad.garus@gmail.com>
2011-03-09 20:55         ` Robert Haas <robertmhaas@gmail.com>
2011-03-11 15:20           ` Bruce Momjian <bruce@momjian.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox