Opened 12 years ago
Closed 12 years ago
#2039 closed defect (fixed)
ST_Area(geography) returning wrong answer
Reported by: | pramsey | Owned by: | pramsey |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 2.1.0 |
Component: | postgis | Version: | 2.0.x |
Keywords: | Cc: | pclark@… |
Description
Reported in the mailing list
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;
The meridian crossing code of the current implementation is tripping.
Change History (3)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
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)
comment:3 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Try trunk at r10407