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

Sandro Santilli strk at keybit.net
Thu Jan 12 03:36:29 PST 2012


On Wed, Jan 11, 2012 at 10:00:06AM -0800, Paul Ramsey wrote:
> You might need to untease it further, as there is no such thing as an
> empty box (in our code, notionally there is)... but right you could
> just have the ~= operator implement the right semantic. OK.
> 
> Having it always be true is fine w/ me.

Ok, this was done as of r8778, also fixing ST_OrderingEquals which
uses that specific operator.

But the ST_Equals case remains. To me any EMPTY should be spatially
equal to any other EMPTY. No matter number of dimensions and type.

It occupies the exactly same space: none.

Codewise we shouldn't have any major problem doing that.

Actually the current code _already_ does that with special
handling in the C side of ST_Equals since r6322 by pramsey on 9 Dec 2010:

  strk=# select _st_equals('POINT EMPTY'::geometry, 'MULTIPOINT ZM EMPTY'::geometry);
   _st_equals
  ------------
   t
  (1 row)

Only, ST_Equals (the wrapper) puts && in between, and && (overlaps) returns
false for the EMPTY BOX. That is EMPTY BOX doesn't overlap EMPTY BOX.
Which I could even agree with.

I'd be in favor of switching ST_Equals to use ~= instead.
Any strong opposition ?

--strk; 

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



More information about the postgis-devel mailing list