[postgis-devel] Should EMPTY be spatially equal to self ?

Sandro Santilli strk at keybit.net
Tue Jan 17 01:47:19 PST 2012


[ please don't trim out attribution lines ]

On Tue, Jan 17, 2012 at 04:15:49AM -0500, Paragon Corporation wrote:
> 
> On Mon, Jan 16, 2012 at 02:19:58PM -0800, Martin Davis wrote:
> >
> > > According to the SF definition of Equals (TFF.FTF.FFT) this 
> > means that 
> > > Equals(EMPTY, EMPTY) = false.  Maybe not the most desirable 
> > result in 
> > > some situations, but it's good to be consistent.  After all, that's 
> > > the whole reason for defining the predicates in terms of 
> > the DE9IM in the first place.
> > 
> > Speaking of consistency, this is the DE9IM of a point to itself:
> > 
> >        0FF.FFF.FF2
> > 
> > It doesn't match the SF definition of Equals (B/B is false).
> > Should a point not be equal to itself for the sake of being 
> > consistent ?
> 
> Strk -- where are you getting these definitions from?

The EQUALS definition was reported by Martin Davis above.

>  ST_Equals is T*F.**F.FF*
> 
> Clearly a point satisfies that.  The only True intersection condition
> absolutely required for 
> equality is that the interiors MUST intersect.  An empty geometry interior
> does not intersect with empty geometry interior

An empty does not have an interior, like a point does not have a boundary.
If it wasn't for points, Equals matrix would be TFF.FTF.FFT.
Since points don't have boundaries (oops) you enlarge to TFF.F*F.FFT.
Since empty don't have interior, you might enlarge to *FF.F*F.FFT,
or take special cases for point and empty.

> because by definition -- 2 geometries intersect if the intersection is not
> empty space.
> You love documentation so much -- its written right here in our docs --
> http://www.postgis.org/documentation/manual-svn/using_postgis_dbmanagement.h
> tml#DE-9IM
> F => empty set

I know this, that's why the DE-9IM of empty-empty is FFF.FFF.FF2
That is, only the exterior of both intersect, and the intersection of
that is an area. Note that the interior of each does not intersect
with the exterior of the other (as there's no interior).

> I think the best way to resolve this is ot just do what the other spatial
> databases do assuming they all do the same.
> Just need some people to test SQL Server and Oracle.

I tend to disagree about that but results I'm happy to look at.

Disagreement is due to proprietary software often seen doing 
silly things due to lack of peer-review.

Remember I've been working years on Gnash, aiming for 100% compatibility
against a player where often the expected behavior was: "crash".

> Keep in mind that spatial equality is VERY different from geometry equality.
> 
> spatial equality: Do 2 geometries occupy the same space?  -- NO (invalid
> geometries also are not equal because
> there space is not well defined) (empty geometry = F)

I belive space here is well defined as being NONE.

> geometric equality: Do 2 containers contain the same geometry? 
>  -- empty geometry -- YES (probably if they are the same typed empty,
> probably false if they are not), invalid geometries - yes

I'm not sure I'm following here.
I hope you mean the vertex-by-vertex equality here (ST_OrderingEquals),
or otherwise I'm missing a third semantic which would complicate things
even further.

--strk;

  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html



More information about the postgis-devel mailing list