[postgis-users] ST_Centroid error on very small polygon

Sandor Csaba sandor.csaba at viamap.hu
Fri Jun 22 02:39:52 PDT 2012


Hi List,

I cannot find answer to this phenomenon:

When I do this select on a very small polygon made of 3 points I get
an empty collection:

VT=# select ST_AsText(ST_Centroid(ST_GeomFromText('POLYGON((56.5286666667
25.2101666667,56.529 25.2105,56.5288333333 25.2103333333,56.5286666667
25.2101666667))')));
        st_astext
--------------------------
 GEOMETRYCOLLECTION EMPTY
(1 row)

If I modify one value just a little bit (56.529=>56.529000000001) I
get correct results:

VT=# select ST_AsText(ST_Centroid(ST_GeomFromText('POLYGON((56.5286666667
25.2101666667,56.529000000001 25.2105,56.5288333333
25.2103333333,56.5286666667 25.2101666667))')));
                st_astext
------------------------------------------
 POINT(56.5288333333337 25.2103333333333)
(1 row)


Any of you seen such thing?

Thank you very much for your help!

Csaba


Versions:

------------------------
 POSTGIS="1.5.2" GEOS="3.2.2-CAPI-1.6.2" PROJ="Rel. 4.7.1, 23
September 2009" LIBXML="2.7.6" USE_STATS

------------------------------------
 PostgreSQL 8.4.11 on x86_64-pc-linux-gnu, compiled by GCC
gcc-4.4.real (Ubuntu 4.4.3-4ubuntu5) 4.4.3, 64-bit

--
Sándor Csaba
szolgáltatási vezető
ViaMap Kft.
Székhely/postacím: 2176 Erdőkürt, Téglaház utca 4.

Iroda:
1076 Budapest, Garay u. 29-31. I. 1.
(EMLA Környezeti Management és Jog Egyesület)


Tel: +3630/9605853
Fax: +3617002542



More information about the postgis-users mailing list