[postgis-users] st_area yields negative value for multi-part polygon

pcreso at pcreso.com pcreso at pcreso.com
Fri Aug 17 15:00:59 PDT 2012


Hi George,

That is not a multi-part polygon (multipolygon). It is a polygon with a hole, & the hole lies outside the polygon boundary so it is going to give weird results. I'm guessing that what you actually mean to do is not:

psql -d test -c "SELECT st_area(ST_GeomFromText('POLYGON((-1 -1, 2 2, 0 1, -1 -1),(3 3, 5 5, 3 5, 3 3))'));"
 st_area 
---------
    -0.5


but 

psql -d test -c "SELECT st_area(ST_GeomFromText('MULTIPOLYGON(((-1 -1, 2 2, 0 1, -1 -1)),((3 3, 5 5, 3 5, 3 3)))'));"
 st_area 
---------
     3.5


HTH,

  Brent Wood


--- On Sat, 8/18/12, george young <georgeryoung at gmail.com> wrote:

From: george young <georgeryoung at gmail.com>
Subject: [postgis-users] st_area yields negative value for multi-part polygon
To: postgis-users at postgis.refractions.net
Date: Saturday, August 18, 2012, 7:58 AM

PostgreSQL 9.1.4 on x86_64-unknown-linux-gnu, compiled by gcc (GCC)
4.4.4 20100630 (Red Hat 4.4.4-10), 64-bit
postgis-2.0.1, libgeos_c.so.1.7.5

gis=# SELECT st_area(ST_GeomFromText('POLYGON((-1 -1, 2 2, 0 1, -1
-1),(3 3, 5 5, 3 5, 3 3))'));
 st_area
---------
    -0.5

what does this mean?  What is negative area?
In general, what are the semantics of polygons with more than one
sequence of vertexes?
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120817/5075c7b2/attachment.html>


More information about the postgis-users mailing list