[postgis-users] plpgsql function for surface of multipolygon with holes

David Blasby dblasby at refractions.net
Thu Jan 29 10:12:36 PST 2004


David TECHER wrote:

select area2d('MULTIPOLYGON (((140 220, 160 140, 200 140, 240 320, 140 
300, 140 220),   (160 260, 180 280, 200 260, 180 220, 160 240, 160 240, 
160 260),   (160 200, 180 200, 180 180, 180 160, 160 180, 160 180, 160 
200)),   ((400 300, 460 260, 420 200, 360 200, 340 260, 340 300, 360 
340, 400 300),     (380 280, 360 260, 380 220, 420 240, 420 240, 380 
280)))'::geometry);

---> 19000

select area2d('POLYGON((140 220, 160 140, 200 140, 240 320, 140 300, 140 
220),   (160 260, 180 280, 200 260, 180 220, 160 240, 160 240, 160 260), 
   (160 200, 180 200, 180 180, 180 160, 160 180, 160 180, 160 
200))'::geometry);

---> 10600

select area2d('POLYGON((400 300, 460 260, 420 200, 360 200, 340 260, 340 
300, 360 340, 400 300),     (380 280, 360 260, 380 220, 420 240, 420 
240, 380 280))'::geometry);

---> 8400



10600 + 8400 = 19000

Whats the problem?  JTS gives the same area...

dave
ps. attached picture of polygon...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: multipolygon1.gif
Type: image/gif
Size: 5065 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20040129/d0f6cf25/attachment.gif>


More information about the postgis-users mailing list