[postgis-tickets] [PostGIS] #4127: ST_Dimension returns 0 for empty GeometryCollection
PostGIS
trac at osgeo.org
Sat Aug 11 01:38:26 PDT 2018
#4127: ST_Dimension returns 0 for empty GeometryCollection
-----------------------+---------------------------
Reporter: esparano | Owner: pramsey
Type: defect | Status: closed
Priority: medium | Milestone: PostGIS 2.4.5
Component: postgis | Version: 2.4.x
Resolution: fixed | Keywords:
-----------------------+---------------------------
Changes (by robe):
* status: reopened => closed
* resolution: => fixed
Comment:
Here is the way I see it
ST_Dimension is a concept of a geometry's geometric type and is defined to
be the maximum dimension of any geometry in the set.
So that said
POINT EMPTY -> 0
LINESTRING EMPTY -> 1
MULTIPOLYGON EMPTY -> 2
SELECT ST_Dimension(ST_Collect('POLYGON EMPTY'::geometry, 'LINESTRING
EMPTY'::geometry)) -> 2
So the only question left is what to do about GEOMETRYCOLLECTION EMPTY.
Does an empty geometrycollection imply we should consider it being the
highest dimension of emptiness or the lowest dimension of emptiness?
I frankly don't care - doesn't seem to be worth changing the code to
address a questionably ambiguous thing
and making it return -1 is liable to break someone's code somewhere, so
would have to wait til PostGIS 3.0 since it is a policy change.
That said, I'm reclosing this bug. If you want to discuss further, about
why this is all wrong,
use our dev mailing list for that:
https://lists.osgeo.org/mailman/listinfo/postgis-devel
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4127#comment:6>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-tickets
mailing list