[postgis-devel] [PostGIS] #1937: must specify "true" to st_length when casting to geography

PostGIS trac at osgeo.org
Thu Jul 26 07:11:49 PDT 2012


#1937: must specify "true" to st_length when casting to geography
---------------------+------------------------------------------------------
 Reporter:  bcrosby  |       Owner:  pramsey      
     Type:  defect   |      Status:  new          
 Priority:  medium   |   Milestone:  PostGIS 2.0.2
Component:  postgis  |     Version:  2.0.x        
 Keywords:           |  
---------------------+------------------------------------------------------
 The following:


 {{{
 st_length(ST_MakeLine(ARRAY[st_geomfromewkt('SRID=4326;POINT(-79.3687166666667
 43.86085)'), st_geomfromewkt('SRID=4326;POINT(-73.7409333333333
 45.4704666666667)')])::geography)
 }}}


 Returns:

 {{{
 ERROR:  function st_length(geography) is not unique
 LINE 1: select st_length(ST_MakeLine(ARRAY[st_geomfromewkt('SRID=432...
                ^
 HINT:  Could not choose a best candidate function. You might need to add
 explicit type casts.
 }}}


 However, this works:


 {{{
 select
 st_length(ST_MakeLine(ARRAY[st_geomfromewkt('SRID=4326;POINT(-79.3687166666667
 43.86085)'), st_geomfromewkt('SRID=4326;POINT(-73.7409333333333
 45.4704666666667)')])::geography,true);
 }}}

 Returns:

 {{{
     st_length
 ------------------
  480679.079363184
 (1 row)
 }}}

 Previous behaviour (in 1.5), you did not need to specify "true" as the
 second parameter to st_length.

 Not sure if this is a bug, or if the documentation should be updated? (I
 was under the impression that 'true' was the default).

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/1937>
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-devel mailing list