[postgis-devel] [PostGIS] #1884: st_centroid fails on a small polygon

PostGIS trac at osgeo.org
Fri Jun 22 05:10:10 PDT 2012


#1884: st_centroid fails on a small polygon
---------------------+------------------------------------------------------
 Reporter:  csandor  |       Owner:  pramsey      
     Type:  defect   |      Status:  new          
 Priority:  medium   |   Milestone:  PostGIS 1.5.4
Component:  postgis  |     Version:  1.5.X        
 Keywords:           |  
---------------------+------------------------------------------------------
 When I do this select on a very small polygon made of 3 points I get
 an empty collection:


 {{{
 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:


 {{{
 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)

 Sandro Santilli confirmed it is bug.

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/1884>
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