BUG #4967: polygon @> point incorrect for points close to shared borders

Started by Paul Matthewsover 16 years ago4 messagesbugs
Jump to latest
#1Paul Matthews
plm@netspace.net.au

The following bug has been logged online:

Bug reference: 4967
Logged by: Paul Matthews
Email address: plm@netspace.net.au
PostgreSQL version: 8.3.7
Operating system: Linux Open Suse 11.0 + 11.1
Description: polygon @> point incorrect for points close to shared
borders
Details:

Have two polygons, both with many vertex, sharing a common edge. Several
thousand points where then tested to see which of the polygons the points
fell into using the "polygon @> point" operator.

A number of points close to the common border claimed they fell into both of
the polygons.

A quick perl+DBI+GD application was developed to plot both the polygons, the
polygon boundaries, as well as the points that thought they where in both.

This showed points close, but still several pixels away from the shared
border, thinking they where in both.

Guidance on this matter would be appreciated.

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Paul Matthews (#1)
Re: BUG #4967: polygon @> point incorrect for points close to shared borders

"Paul Matthews" <plm@netspace.net.au> writes:

A number of points close to the common border claimed they fell into both of
the polygons.

How close is "close"? There's some pretty arbitrary fuzzy-comparisons
logic in the geometric datatypes ... see FPeq() and friends. That might
be doing it to you.

regards, tom lane

#3Paul Matthews
plm@netspace.net.au
In reply to: Tom Lane (#2)
Re: BUG #4967: polygon @> point incorrect for points close to shared borders

Attachments:

minipic.pngimage/png; name=minipic.pngDownload
#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Paul Matthews (#3)
Re: BUG #4967: polygon @> point incorrect for points close to shared borders

Paul Matthews <plm@netspace.net.au> writes:

How close is "close"? There's some pretty arbitrary fuzzy-comparisons
logic in the geometric datatypes ... see FPeq() and friends. That might
be doing it to you.

I'll try to figure out how "relatively" close tonight, this stuff is
sub-metre resolution GPS data. The attached picture shows the two
polygons, the shared border, a road in this case, and the houses that
think they are on both sides of the road. Houses and other features are
located with latitude+longitude.<br>

Hmm ... just out of curiosity, why aren't you using PostGIS for this?
Our built-in geometric types are mostly an academic proof-of-concept,
they aren't industrial strength IMHO.

regards, tom lane