Counting Things
Regina Obe
lr at pcorp.us
Thu Feb 15 21:11:37 PST 2024
Yah all empty geometries returning 0 for ST_NumGeometries makes sense to me.
I think we had this discussion a while back and we decided that's the only consistent way to handle it.
ST_numgeometries(null) => null
ST_Numgeometries(anyemptything) => 0
> -----Original Message-----
> From: Paul Ramsey <pramsey at cleverelephant.ca>
> Sent: Thursday, February 15, 2024 6:16 PM
> To: PostGIS Development Discussion <postgis-devel at lists.osgeo.org>
> Subject: Re: Counting Things
>
> I guess it makes more sense with added context.
>
> pramsey=# select st_numgeometries('MULTIPOINT EMPTY');
> st_numgeometries
> ------------------
> 0
> (1 row)
>
> pramsey=# select st_numgeometries('POINT EMPTY'); st_numgeometries
> ------------------
> 0
> (1 row)
>
> pramsey=# select st_numgeometries('POINT (1 1)'); st_numgeometries
> ------------------
> 1
> (1 row)
>
> On Thu, Feb 15, 2024 at 3:14 PM Paul Ramsey <pramsey at cleverelephant.ca>
> wrote:
> >
> > Since we are counting things, this seemed a little suspicious to me:
> >
> > pramsey=# select ST_NumGeometries('POINT(0 0)'); st_numgeometries
> > ------------------
> > 1
> > (1 row)
> >
> > pramsey=# select st_numgeometries('POINT EMPTY'); st_numgeometries
> > ------------------
> > 0
> > (1 row)
> >
> > Hmmmmmm,
> >
> >P
More information about the postgis-devel
mailing list