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

Havard Tveite havard.tveite at umb.no
Fri Jan 13 02:01:21 PST 2012


1) ST_Equals can be used as a spatial join predicate.
2) An empty geometry has no location.

Therefore, I think that ST_Equals(empty,empty) should
not return true and not return false, but NULL.
What would be the consequences of that?

Håvard Tveite

On 1/12/2012 12:36 PM, Sandro Santilli 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 ?
>
> --strk;
>
>    ()   Free GIS&  Flash consultant/developer
>    /\   http://strk.keybit.net/services.html
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel
>

-- 
Håvard Tveite
Department of Mathematical Sciences and Technology, UMB
Drøbakveien 31, POBox 5003, N-1432 Ås, NORWAY
Phone: +47 64965483 Fax: +47 64965401 http://www.umb.no/imt/



More information about the postgis-devel mailing list