[postgis-tickets] [PostGIS] #3777: POINT EMPTY, POINT 0 0 anomaly

PostGIS trac at osgeo.org
Wed Jun 21 05:42:55 PDT 2017


#3777: POINT EMPTY, POINT 0 0 anomaly
---------------------+---------------------------
 Reporter:  robe     |      Owner:  pramsey
     Type:  defect   |     Status:  new
 Priority:  medium   |  Milestone:  PostGIS 2.3.3
Component:  postgis  |    Version:  2.3.x
 Keywords:           |
---------------------+---------------------------
 As Pierre pointed out in:

 https://lists.osgeo.org/pipermail/postgis-users/2017-June/042203.html

 We've got what appears to be a bug with our handling of POINT EMPTY, POINT
 0 0.

 Tested on PostGIS 2.3 and 2.4


 {{{
 SELECT ST_AsText(geom) txt, count(*)
 FROM (
 SELECT 'POINT(0 0)'::geometry geom
 UNION ALL
 SELECT 'POINT(0 0)'::geometry geom
 UNION ALL
 SELECT 'POINT(0 0)'::geometry geom
 UNION ALL
 SELECT 'POINT(0 1)'::geometry geom
 UNION ALL
 SELECT 'LINESTRING(0 0,0 1)'::geometry geom
 UNION ALL
 SELECT 'GEOMETRYCOLLECTION EMPTY'::geometry geom
 UNION ALL
 SELECT 'POINT EMPTY'::geometry geom
 ) foo
 GROUP BY geom;
 }}}

 Yields:


 {{{
            txt            | count
 --------------------------+-------
  POINT(0 0)               |     2
  POINT EMPTY              |     1
  POINT(0 0)               |     1
  LINESTRING(0 0,0 1)      |     1
  GEOMETRYCOLLECTION EMPTY |     1
  POINT(0 1)               |     1

 }}}

 when it should be yielding something along the lines of:

 {{{
            txt            | count
 --------------------------+-------
  POINT(0 0)               |     3
  LINESTRING(0 0,0 1)      |     1
  GEOMETRYCOLLECTION EMPTY |     2
  POINT(0 1)               |     1


 }}}

 Since POINT EMPTY and GEOMETRYCOLLECTION have null boxes they should
 aggregate together and since points and 2 point lines should have no
 boxes, they should be taken literally.


 I did the same exercise in PostGIS 1.5 and got this:


 {{{
            txt            | count
 --------------------------+-------
  GEOMETRYCOLLECTION EMPTY |     4
  LINESTRING(0 0,0 1)      |     1
  GEOMETRYCOLLECTION EMPTY |     1
  POINT(0 1)               |     1
 (4 rows)

 }}}

 which I attributed to the fact that at one point of time, since we had no
 concept of POINT EMPTY we always output the representation as
 GEOMETRYCOLLECTION EMPTY  and I think there was one function that used
 POINT(0 0) as rep for POINT EMPTY. Though I could be mistaken.

--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/3777>
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