[postgis-devel] [PostGIS] #450: ST_Area(geography) returns wrong result for objects crossing dateline

PostGIS trac at osgeo.org
Thu Feb 25 05:35:20 PST 2010


#450: ST_Area(geography) returns wrong result for objects crossing dateline
----------------------+-----------------------------------------------------
  Reporter:  pramsey  |       Owner:  pramsey      
      Type:  defect   |      Status:  new          
  Priority:  high     |   Milestone:  PostGIS 1.5.1
 Component:  postgis  |     Version:  1.5.X        
Resolution:           |    Keywords:               
----------------------+-----------------------------------------------------
Old description:

> http://postgis.refractions.net/pipermail/postgis-users/2010-
> February/025984.html
>
> A box that doesn't cross the dateline returns a good result:
> {{{
> g4wd=# select st_area(g)/1000000, st_area(transform(geometry(g), 4326)),
> astext(geometry(g)) from (select 'POLYGON((178.5 2, 178.5 1, 179.5 1,
> 179.5
> 2, 178.5 2))'::geography) as foo(g);
>     ?column?     | st_area |                       astext
> -----------------+---------+----------------------------------------------------
>  12304.814950073 |       1 | POLYGON((178.5 2,178.5 1,179.5 1,179.5
> 2,178.5
> 2))
> (1 row)
> }}}
> But the same box s
> hifted over the dateline returns a bad result.
> {{{g4wd=# select st_area(g)/1000000, st_area(transform(geometry(g),
> 4326)),
> astext(geometry(g)) from (select 'POLYGON((179.5 2, 179.5 1, -179.5 1,
> -179.5 2, 179.5 2))'::geography) as foo(g);
>      ?column?     | st_area |                        astext
> ------------------+---------+------------------------------------------------------
>  55910.8880691158 |     359 | POLYGON((179.5 2,179.5 1,-179.5 1,-179.5
> 2,179.5 2))
> (1 row)
> }}}

New description:

 http://postgis.refractions.net/pipermail/postgis-users/2010-
 February/025984.html

 A box that doesn't cross the dateline returns a good result:
 {{{
 g4wd=# select st_area(g)/1000000, st_area(transform(geometry(g), 4326)),
 astext(geometry(g)) from (select 'POLYGON((178.5 2, 178.5 1, 179.5 1,
 179.5
 2, 178.5 2))'::geography) as foo(g);
     ?column?     | st_area |                       astext
 -----------------+---------+----------------------------------------------------
  12304.814950073 |       1 | POLYGON((178.5 2,178.5 1,179.5 1,179.5
 2,178.5
 2))
 (1 row)
 }}}
 But the same box s
 hifted over the dateline returns a bad result.
 {{{
 g4wd=# select st_area(g)/1000000, st_area(transform(geometry(g), 4326)),
 astext(geometry(g)) from (select 'POLYGON((179.5 2, 179.5 1, -179.5 1,
 -179.5 2, 179.5 2))'::geography) as foo(g);
      ?column?     | st_area |                        astext
 ------------------+---------+------------------------------------------------------
  55910.8880691158 |     359 | POLYGON((179.5 2,179.5 1,-179.5 1,-179.5
 2,179.5 2))
 (1 row)
 }}}

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/450#comment:1>
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