Opened 8 years ago

Closed 8 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:


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]');
(1 row)

postgis_2=# select 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]');
(1 row)

postgis_1_5=# select 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 Changed 8 years ago by pramsey

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 Changed 8 years ago by darkpanda

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 Changed 8 years ago by pramsey

Component: postgisdocumentation
Owner: changed from pramsey to robe

comment:4 Changed 8 years ago by robe

Resolution: fixed
Status: newclosed

fixed at r9618

Note: See TracTickets for help on using tickets.