Ticket #503 (closed defect: fixed)
ST_Area on small polygons in EPSG:31467 gives incorrect results depending on 32-/64-system-architecture
| Reported by: | mjansen | Owned by: | pramsey |
|---|---|---|---|
| Priority: | medium | Milestone: | PostGIS 2.0.0 |
| Component: | postgis | Version: | 1.5.X |
| Keywords: | Cc: | birgit.laggner@… |
Description
See this thread on the postgis-users-list: http://old.nabble.com/st_area-and-0.001953125-td28217229.html
Running this SQL:
SELECT ST_Area(ST_GeomFromEWKT(foo.ewkt)) AS area FROM ( SELECT 'SRID=31467;POLYGON((3508395.5093 5910738.8973,3508505.2864 5910690.8533,3508300.641 5910780.4164,3508395.5093 5910738.8973))' as ewkt UNION SELECT 'SRID=31467;POLYGON((3508395.5093 5949092.7294,3508333.8642 5949090.138,3508411.1808 5949093.3882,3508395.5093 5949092.7294))' as ewkt UNION SELECT 'SRID=31467;POLYGON((3498246.2563 5815493.2389,3498246.2472 5815493.1259,3498246.2094 5815493.1202,3498246.2563 5815493.2389))' as ewkt UNION SELECT 'SRID=31467;POLYGON((3539635.9601 5832797.6616,3539635.9574 5832797.6613,3539635.9565 5832797.6851,3539635.9601 5832797.6616))' as ewkt UNION SELECT 'SRID=31467;POLYGON((3546842.9496103 5778962.75289926,3546842.9761781 5778962.61321963,3546842.976 5778962.613,3546842.9496103 5778962.75289926))' as ewkt UNION SELECT 'SRID=31467;POLYGON((3427425.5879 5841806.726,3427416.0171 5841792.2466,3427416.01703247 5841792.24664866,3427425.5879 5841806.726))' as ewkt UNION SELECT 'SRID=31467;POLYGON((3538420.34038636 5912791.09822265,3538420.31141462 5912790.97224757,3538420.3113 5912790.9723,3538420.34038636 5912791.09822265))' as ewkt UNION SELECT 'SRID=31467;POLYGON((3577970.8916 5729534.987,3577827.5551 5729621.0532,3577805.6282 5729634.2192,3577970.8916 5729534.987))' as ewkt UNION SELECT 'SRID=31467;POLYGON((3472882.79775403 5870816.50310222,3472882.7978 5870816.5031,3472875.19541818 5870717.64922727,3472882.79775403 5870816.50310222))' as ewkt UNION SELECT 'SRID=31467;POLYGON((3557563.34513562 5791040.4530635,3557563.44511383 5791040.49625184,3557563.3452 5791040.4529,3557563.34513562 5791040.4530635))' ) as foo(ewkt);
Should return
area ---------------------- 0.00210952758789062 8.58306884765625e-06 0.00310611724853516 0.00228118896484375 8.58306884765625e-06 3.24249267578125e-05 0.000721931457519531 0.00169944763183594 1.43051147460938e-05 0.000333786010742188
And does so on
POSTGIS="1.4.1" GEOS="3.1.0-CAPI-1.5.0" PROJ="Rel. 4.6.1, 21 August 2008" USE_STATS
running on
PostgreSQL 8.4.2 on i486-pc-linux-gnu, compiled by GCC gcc-4.4.real (Ubuntu 4.4.1-4ubuntu8) 4.4.1, 32-bit
For the following combinations of PostgreSQL / PostGIS
PostgreSQL 8.2.4 on x86_64-pc-linux-gnu, compiled by GCC cc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) POSTGIS="1.3.1" GEOS="2.2.3-CAPI-1.1.1" PROJ="Rel. 4.4.9, 29 Oct 2004" USE_STATS
PostgreSQL 8.4.3 on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.4.3 20100316 (prerelease), 64-bit POSTGIS="1.5.1" GEOS="3.2.0-CAPI-1.6.0" PROJ="Rel. 4.7.1, 23 September 2009" LIBXML="2.7.6" USE_STATS
PostgreSQL 8.2.13 on x86_64-unknown-linux-gnu, compiled by GCC gcc (SUSE Linux) 4.3.2 [gcc-4_3-branch revision 141291] POSTGIS="1.3.6" GEOS="3.1.1-CAPI-1.6.0" PROJ="Rel. 4.6.1, 21 August 2008" USE_STATS
PostgreSQL 8.2.15 on x86_64-unknown-linux-gnu, compiled by GCC gcc (SUSE Linux) 4.4.1 [gcc-4_4-branch revision 150839] POSTGIS="1.3.6" GEOS="3.1.1-CAPI-1.6.0" PROJ="Rel. 4.7.1, 23 September 2009" USE_STATS (procs from 1.3.3 need upgrade)
PostgreSQL 8.4.2 on x86_64-unknown-linux-gnu, compiled by GCC gcc (SUSE Linux) 4.4.1 [gcc-4_4-branch revision 150839], 64-bit POSTGIS="1.4.0" GEOS="3.2.0-CAPI-1.6.0" PROJ="Rel. 4.6.1, 21 August 2008" USE_STATS
The query returns areas of either 0 or 0.001953125, e.g.:
area
-------------
0
0.001953125
0.001953125
0.001953125
0.001953125
0.001953125
0.001953125
0.001953125
0
0.001953125
The one visible difference between the systems is that the code works as expected on 32-bit-machines, but gives strange results on 64-bit-machines.
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

