[postgis-users] strange behavior of ST_Area(geography)

IIDA Tetsushi hogeman at gmail.com
Sun Oct 15 04:42:03 PDT 2017


Hi,

These polygons have the same shape but orientation.

--- my query -----
WITH poly AS (
 SELECT
  ST_SetSRID(ST_GeomFromText(
   'POLYGON((138.002 37.001, 138.003 37.0010, 138.003 37.0013, 138.002 37.001))'
   ),4326) g1,
  ST_SetSRID(ST_GeomFromText(
   'POLYGON((138.002 37.001, 138.003 37.0013, 138.003 37.0010, 138.002 37.001))'
   ),4326) g2
)
SELECT ST_Equals(g1,g2),
 ST_Area(g1)                     = ST_Area(g2) AS eq_area,
 ST_Area(g1::geography)          = ST_Area(g2::geography) AS geog1,
 ST_Area(g1::geography, false)   = ST_Area(g2::geography, false) AS geog2,
 ST_Area(g1::geography)          = ST_Area(ST_Reverse(g2)::geography) AS geog3,
 ST_Area(ST_Transform(g1,32654)) = ST_Area(ST_Transform(g2,32654)) AS geom
 FROM poly;

----- output -----

 st_equals | eq_area | geog1 | geog2 | geog3 | geom
-----------+---------+-------+-------+-------+------
 t         | t       | f     | t     | t     | t


I expected all these tests return true.
Is this behavior by spec?

Thanks

-- 
hogeman


More information about the postgis-users mailing list