[geos-devel] Should DistanceWithin(EMPTY, ANYTHING, ANYDISTANCE) always return false ?

Paul Ramsey pramsey at cleverelephant.ca
Mon Oct 4 08:50:47 PDT 2021


https://trac.osgeo.org/postgis/wiki/DevWikiEmptyGeometry


pramsey=# select st_distance('POINT(1 1)','POINT EMPTY');
 st_distance 
-------------
            
(1 row)

Interesting note in the wiki about returning NULL for DWithin. 

Current behaviour.

pramsey=# select st_dwithin('POINT(1 1)','POINT EMPTY', 1);
 st_dwithin 
------------
 f
(1 row)

pramsey=# select st_dwithin('POINT(1 1)','POINT EMPTY', 'Inf'::float8);
 st_dwithin 
------------
 t
(1 row)

I could see going for "always false" since we're almost there for non-inf values.

P

> On Oct 4, 2021, at 8:08 AM, Sandro Santilli <strk at kbt.io> wrote:
> 
> On Mon, Oct 04, 2021 at 05:02:24PM +0200, Sandro Santilli wrote:
>> I'd think yes, honestly, but the current code returns TRUE sometimes,
>> particularly for MAXDISTANCE being Infinite...
>> 
>> As I think GEOS is not being used by phylosophers, I can't find any
>> reason why would anyone want a TRUE result from a DistanceWithin()
>> query involving an EMPTY geometry.
> 
> We have the same issue on PostGIS:
> https://trac.osgeo.org/postgis/ticket/5008
> 
> --strk;
> _______________________________________________
> geos-devel mailing list
> geos-devel at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/geos-devel



More information about the geos-devel mailing list