[postgis-users] ST_Area returning NaN near the poles?

Peter Clark pclark at umn.edu
Wed Oct 10 09:25:58 PDT 2012


Hi:

I'm working with some simple geography polygons that are near the poles. For some of them (but not all), I'm getting NaN as the result of calling ST_Area. (The odd numerical values for the polygons are the result of calling ST_PixelAsPolygon() on tiles from a global-extent raster.)

This may be related to Trac #2006.

SELECT ST_Area(ST_GeogFromText('SRID=4326;POLYGON((-154.999994561031 89.99999,-154.91666122652 89.99999,-154.91666122652 89.9166566643108,-154.999994561031 89.9166566643108,-154.999994561031 89.99999))'));

returns NaN.

However, this polygon, just a bit to the east, returns a valid number:

SELECT ST_Area(ST_GeogFromText('SRID=4326;POLYGON((-146.666661109933 89.99999,-146.583327775422 89.99999,-146.583327775422 89.9166566643108,-146.666661109933 89.9166566643108,-146.666661109933 89.99999))'));

I'm running PostGIS 2.0.1 with PostgreSQL 9.1.4 on Mac OS/X 10.8.2:

mydatabase=# select PostGIS_Full_Version();
NOTICE:  Function postgis_topology_scripts_installed() not found. Is topology support enabled and topology.sql installed?
                                                                     postgis_full_version                                                                     
--------------------------------------------------------------------------------------------------------------------------------------------------------------
 POSTGIS="2.0.1 r9979" GEOS="3.3.5-CAPI-1.7.5" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.9.1, released 2012/05/15" LIBXML="2.7.3" LIBJSON="UNKNOWN" RASTER
(1 row)

and have reproduced it on PostGIS 2.0.0 with PostgreSQL 9.1.4 on Ubuntu.

Best,
   Pete





More information about the postgis-users mailing list