Opened 12 years ago

Closed 7 years ago

#1884 closed defect (fixed)

st_centroid fails on a small polygon [fixed by GEOS-3.3.5]

Reported by: csandor Owned by: pramsey
Priority: medium Milestone: PostGIS GEOS
Component: postgis Version: 1.5.X
Keywords: Cc:

Description

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.

Change History (3)

comment:1 by strk, 12 years ago

Milestone: PostGIS 1.5.4PostGIS GEOS

comment:2 by strk, 12 years ago

Summary: st_centroid fails on a small polygonst_centroid fails on a small polygon [fixed by GEOS-3.3.5]

GEOS-3.3.5 (to be released within a week) will contain a fix for this

comment:3 by pramsey, 7 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.