[postgis-tickets] [PostGIS] #4598: spurious results of ST_Centroid on invalid polygons of type geography
PostGIS
trac at osgeo.org
Tue Aug 11 18:45:14 PDT 2020
#4598: spurious results of ST_Centroid on invalid polygons of type geography
----------------------+---------------------------
Reporter: fadi | Owner: pramsey
Type: defect | Status: closed
Priority: medium | Milestone: PostGIS 2.5.5
Component: postgis | Version: 3.0.x
Resolution: wontfix | Keywords:
----------------------+---------------------------
Changes (by robe):
* status: new => closed
* resolution: => wontfix
Comment:
I'm going to dismiss this as a won't fix. The first one looks right
{{{
WITH geogs (geog) AS (VALUES
('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))'::geography),
('POLYGON((0 0, 1 1, 1 1, 0 0))'::geography),
('POLYGON((0 0, 1 1, 1 0, 0 1, 0 0))'))
SELECT
pg_typeof(geog),
ST_IsValidReason(geog::geometry),
ST_AsText(ST_Centroid(geog)),
ST_AsText(ST_Centroid(geog::geometry)),
ST_AsText(ST_Transform(ST_Centroid(ST_Transform(geog::Geometry,_ST_BestSRID(Geog))),4326)
)
FROM geogs;
}}}
I get this:
{{{
POINT(0.499934819426203 0.500006912686044)
}}}
which isn't too far off from the geography answer. As to handling invalid
polygons I'm not convinced it's worth thinking about.
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4598#comment:4>
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-tickets
mailing list