[PostGIS] #6076: ST_Length() on GEOMETRYCOLLECTION for geography type

PostGIS trac at osgeo.org
Wed May 6 07:46:05 PDT 2026


#6076: ST_Length() on GEOMETRYCOLLECTION for geography type
-------------------------+---------------------------
 Reporter:  paleolimbot  |      Owner:  pramsey
     Type:  defect       |     Status:  new
 Priority:  medium       |  Milestone:  PostGIS 3.6.3
Component:  postgis      |    Version:  3.6.x
 Keywords:               |
-------------------------+---------------------------
 For all eight people that have ever calculated the length of a geometry
 collection for the geography type (and all zero of them that *should*
 have):

 {{{
 -- For geometry, ST_Length returns just the linestring length (1.0)
 SELECT ST_Length(ST_GeomFromText('GEOMETRYCOLLECTION (POINT (5 5),
 LINESTRING (0 0, 0 1), POLYGON ((0 0, 0 1, 1 0, 0 0)))'));
 -- Result: 1.0

 -- For geography, ST_Length is different
 SELECT ST_Length(ST_GeogFromText('GEOMETRYCOLLECTION (POINT (5 5),
 LINESTRING (0 0, 0 1), POLYGON ((0 0, 0 1, 1 0, 0 0)))'));
 -- Result: 489367.83620021143

 -- Expected: just the linestring length as geography (~110574 meters)
 SELECT ST_Distance(ST_GeogFromText('POINT (0 0)'), ST_GeogFromText('POINT
 (0 1)'));
 -- Result: 110574.3885578
 }}}

 I tested using the postgis/postgis:18-3.6 docker image (with apologies if
 this has been fixed since).
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/6076>
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