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

Sandro Santilli strk at kbt.io
Mon Oct 4 15:43:13 PDT 2021


I pushed a commit to main branch always returning false.

Same on the PostGIS side, but I don't know up to which version I
should backport that. If you have old versions around, could you
please leave a comment in https://trac.osgeo.org/postgis/ticket/5008 ?

--strk;

On Mon, Oct 04, 2021 at 07:56:34PM +0300, Darafei "Komяpa" Praliaskouski wrote:
> Points on infinite distance are still on the extended R2+ plane. The empty
> points aren't.
> 
> This one should be "always false", and make sure that "POINT(INF INF)" is
> at INF distance from anything (can be true). POINT(Inf Inf) != POINT(NaN
> NaN) in this aspect.
> 
> On Mon, Oct 4, 2021 at 6:50 PM Paul Ramsey <pramsey at cleverelephant.ca>
> wrote:
> 
> > 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
> >
> > _______________________________________________
> > geos-devel mailing list
> > geos-devel at lists.osgeo.org
> > https://lists.osgeo.org/mailman/listinfo/geos-devel
> >

> _______________________________________________
> geos-devel mailing list
> geos-devel at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/geos-devel


-- 

  Libre GIS consultant/developer
  https://strk.kbt.io/services.html


More information about the geos-devel mailing list