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

Paul Ramsey pramsey at opengeo.org
Thu Jan 12 09:27:56 PST 2012


On Thu, Jan 12, 2012 at 3:36 AM, Sandro Santilli <strk at keybit.net> wrote:
> 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 ?

Haven't we determined that ~= isn't index bound at the moment? Isn't
that problematic?
P.



More information about the postgis-devel mailing list