[postgis-devel] [PostGIS] #1154: ST_Area returns wrong results for big geography polygon [-179.9 -89.9 179.9 89.9 ]

PostGIS trac at osgeo.org
Fri Aug 5 00:02:19 PDT 2011


#1154: ST_Area returns wrong results for big geography polygon [-179.9 -89.9 179.9
89.9 ]
---------------------------------------------+------------------------------
 Reporter:  mvimercati                       |       Owner:  pramsey
     Type:  defect                           |      Status:  new    
 Priority:  high                             |   Milestone:         
Component:  postgis                          |     Version:  1.5.X  
 Keywords:  ST_Area geography big huge area  |  
---------------------------------------------+------------------------------
 Seems that ST_Area has some problem calculating very big area, like global
 area [ minlon=-179.9 minlat=-89.9 maxlon=179.9 maxlat=89.9 ].
 I remember earth areas is about 510348973 km2

 This calculates the area of half earth (near, I'm not crossing dateline),
 and seems correct

 {{{
 select st_area(g)/1000000, st_area(transform(geometry(g),
 4326)),astext(geometry(g)) from (select 'POLYGON((0 89.9, 179.9 89.9,
 179.9 -89.9, 0 -89.9, 0 89.9))'::geography) as foo(g);
      ?column?     | st_area  |                         astext
 ------------------+----------+---------------------------------------------------------
  255174486.625509 | 32346.02 | POLYGON((0 89.9,179.9 89.9,179.9 -89.9,0
 -89.9,0 89.9))
 }}}

 where the whole globe gives strange result:

 {{{
 st_area(transform(geometry(g), 4326)),astext(geometry(g)) from (select
 'POLYGON((-179.9 89.9, 179.9 89.9, 179.9 -89.9, -179.9 -89.9, -179.9
 89.9))'::geography) as foo(g);
      ?column?     | st_area  |                                 astext
 ------------------+----------+------------------------------------------------------------------------
  283369.499733791 | 64692.04 | POLYGON((-179.9 89.9,179.9 89.9,179.9
 -89.9,-179.9 -89.9,-179.9 89.9))
 }}}

 I'm running Postgis 1.5.3 on Postgres 9.0.4. Arch Linux 64bit

 Best Regards
 Vime

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