Opened 12 years ago

Closed 12 years ago

#1757 closed defect (fixed)

Spheroid length functions returning unexpected results.

Reported by: darkpanda Owned by: robe
Priority: medium Milestone: PostGIS 2.0.1
Component: documentation Version: 2.0.x
Keywords: Cc:

Description

This may be related to an older (closed) ticket involving similar sphere functions. See #1136 for details on that.

The geometry and spheroid I'm using for testing are as follows:

POLYGON((-5 -5,-5 5,5 5,5 -5,-5 -5))
SPHEROID["WGS 84", 6378137, 298.257223563]

The results of the ST_3dlength_spheroid/ST_length_spheroid functions do not match with the results from previous versions of PostGIS.

Here's PostGIS 2.0.0 on my machine:

postgis_2=# SELECT ST_3dlength_spheroid('POLYGON((-5 -5,-5 5,5 5,5 -5,-5 -5))', 'SPHEROID["WGS 84", 6378137, 298.257223563]');
 st_3dlength_spheroid 
----------------------
     4429494.47924311
(1 row)

postgis_2=# select postgis_full_version();
                                                                  postgis_full_version                                                                   
----------------------------------------------------------------------------------------------------------------------------------------------------------
 POSTGIS="2.0.0 r9605" GEOS="3.3.3-CAPI-1.7.4" PROJ="Rel. 4.7.1, 23 September 2009" GDAL="GDAL 1.9.0, released 2011/12/29" LIBXML="2.7.8" TOPOLOGY RASTER
(1 row)

And PostGIS 1.5.3:

postgis_1_5=# SELECT ST_length3d_spheroid('POLYGON((-5 -5,-5 5,5 5,5 -5,-5 -5))', 'SPHEROID["WGS 84", 6378137, 298.257223563]');
 st_length3d_spheroid 
----------------------
                    0
(1 row)

postgis_1_5=# select postgis_full_version();
                                         postgis_full_version                                          
-------------------------------------------------------------------------------------------------------
 POSTGIS="1.5.3" GEOS="3.3.3-CAPI-1.7.4" PROJ="Rel. 4.7.1, 23 September 2009" LIBXML="2.7.8" USE_STATS
(1 row)

Here's the PostgreSQL version() information:

PostgreSQL 9.1.3 on x86_64-apple-darwin11.3.0, compiled by i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00), 64-bit

Change History (4)

comment:1 by pramsey, 12 years ago

1.5 was kicking it out as "polygons have no length" and 2.0 is giving you "oh, OK how about the perimeter?". It's a change in behaviour, but I think it's a positive one, no?

comment:2 by darkpanda, 12 years ago

Ah, okay. That makes sense then, albeit unexpected, as the docs page for ST_3DLength_Spheroid doesn't mention this and still refers to the old behaviour saying "Will return 0 for anything that is not a MULTILINESTRING or LINESTRING", so that should probably be updated.

I also notice that on the docs page for ST_3DLength_Spheroid, the docs say that "in prior versions this used to be called ST_Length_Spheroid3D", but I believe the older name for this function was ST_Length3D_Spheroid.

comment:3 by pramsey, 12 years ago

Component: postgisdocumentation
Owner: changed from pramsey to robe

comment:4 by robe, 12 years ago

Resolution: fixed
Status: newclosed

fixed at r9618

Note: See TracTickets for help on using tickets.