[postgis-devel] [PostGIS] #2039: ST_Area(geography) returning wrong answer

PostGIS trac at osgeo.org
Fri Oct 12 12:21:37 PDT 2012


#2039: ST_Area(geography) returning wrong answer
---------------------+------------------------------------------------------
 Reporter:  pramsey  |       Owner:  pramsey      
     Type:  defect   |      Status:  new          
 Priority:  medium   |   Milestone:  PostGIS 2.1.0
Component:  postgis  |     Version:  2.0.x        
 Keywords:           |  
---------------------+------------------------------------------------------

Comment(by pclark):

 This works for me using r10420; hadn't tried r10407. The results aren't
 identical, but they're close enough for what I care about - the
 discrepancy between the two polygons is on the order of 500 square cm, as
 opposed to twice the area of California like they were in postgis 2.0.1.
 :-)

 {{{
  WITH shapes as (
   select 1 as rownum, ST_GeogFromText('POLYGON((-144 -63,-144 -54,-126
 -54,-126 -63,-144 -63))') as shape
   union
   select 2 as rownum, ST_GeogFromText('POLYGON((-90 -63,-90 -54,-72
 -54,-72 -63,-90 -63))') as shape
   )
   select rownum, ST_Area(shape) as spheroid, ST_Area(shape, false) as
 sphere,
         ST_Area(shape) - ST_Area(shape, false) as delta
   from shapes;

 }}}

 returns

 {{{
   rownum |     spheroid     |      sphere      |      delta
  --------+------------------+------------------+------------------
        1 | 1040833443426.79 |  1035406049943.1 | 5427393483.68726
        2 | 1040833443426.79 | 1035406049943.05 | 5427393483.73877
  (2 rows)

 }}}

-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/2039#comment:2>
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