[postgis-tickets] [PostGIS] #3195: ST_Length on 3D geography gives 3D length

PostGIS trac at osgeo.org
Tue Jul 7 23:41:38 PDT 2015


#3195: ST_Length on 3D geography gives 3D length
---------------------+----------------------------
 Reporter:  mwtoews  |      Owner:  pramsey
     Type:  defect   |     Status:  new
 Priority:  medium   |  Milestone:  PostGIS Future
Component:  postgis  |    Version:  trunk
 Keywords:           |
---------------------+----------------------------
 ST_Length on a 3D geometry gives a 2D length, as clearly documented.
 However, ST_Length on a 3D geography gives a 3D length, which is not
 documented. Either:

  1. the function behaviour on geography needs to change to be similar to
 geography type, or
  2. the documentation for ST_Length needs to be updated to reflect the
 behaviour for 3D geography

 As a side note, ST_Length_Spheroid on a 3D geometry gives a 3D length, as
 documented.

 Here's an example:
 {{{
 SELECT ST_Length(geom) AS geom_2d_length, ST_3DLength(geom) AS
 geom_3d_length,
   ST_Length(ST_Transform(geom, 4326)::geography) AS geog_3d_length,
   ST_Length(ST_Transform(ST_Force2D(geom), 4326)::geography) AS
 geog_2d_length,
   ST_Length_Spheroid(ST_Transform(ST_Force2D(geom), 4326), spheroid) AS
 spheroid_length_2d,
   ST_Length_Spheroid(ST_Transform(geom, 4326), spheroid) AS
 spheroid_length_3d
 FROM (
   SELECT 'SRID=27700;MULTILINESTRING((
  423216.279 574665.249 0, 423206.315 574708.077 44.649,
  423158.458 574896.911 242.525, 423132.406 574993.061 344))'::geometry AS
 geom,
  'SPHEROID["WGS 84",6378137,298.257223563]'::spheroid
 ) AS f;
 -[ RECORD 1 ]------+-----------------
 geom_2d_length     | 338.39264086563
 geom_3d_length     | 482.54086040695
 geog_3d_length     | 482.622196178051
 geog_2d_length     | 338.515774984236
 spheroid_length_2d | 338.515774984236
 spheroid_length_3d | 482.622196178051
 }}}

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