[postgis-users] TR: strange behavior of ST_Area(geography)
    Iida, Tetsushi 
    hogeman at gmail.com
       
    Tue Oct 17 04:51:06 PDT 2017
    
    
  
Regina  Obe wrote:
> What does this query return you
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
),self_intersection AS (
  SELECT g1, ST_Intersection(g1, g1) g2 FROM poly
)
SELECT ST_Equals(g1,g2), ST_Orientation(g1), ST_Orientation(g2),
 ST_Area(g1)            - ST_Area(g2) AS geom,
 ST_Area(g1::geography) - ST_Area(g2::geography) AS geog1,
 ST_Area(g1::geography) - ST_Area(ST_Reverse(g2)::geography) AS geog2
 FROM self_intersection;
 st_equals | st_orientation | st_orientation | geom |        geog1
   | geog2
-----------+----------------+----------------+------+---------------------+-------
 t         |             -1 |              1 |    0 |
0.00582150976060802 |     0
The difference is small but it was surprising to me.
Mike Toews wrote:
> For PROJ versions prior to 4.9.0, the PostGIS algorithms are not
> robust for geographic area calculations, so I'm not surprised to see
> these results.
Thank you, I understand the problem.
    
    
More information about the postgis-users
mailing list