[postgis-users] Area calculation

Markus Schaber schabios at logi-track.com
Tue Jan 27 14:43:37 PST 2004


Hi, Dirk,

On Tue, 27 Jan 2004 17:25:21 +0100
Dirk Geschwandtner <dg at mapmedia.de> wrote:

> I nee to calculate the areas of swiss-cheese-polygons without the
> holes in postgis.
> 
> I tried convexhull, but this not always returns the correct results,
> the area is slighty bigger than the area of the original.

This is because of the definition of a convex hull, it builds a hull
that is convex around the object. That means that it removes all concave
corners, means all corners that point "into" the object.

If you e. G. have a shape like

     +-+
     | |
   +-* *-+  (I marked all "guilty" corners with a * )
   |     |
   +-* *-+
     | |
     +-+

it gets converted to

     +-+
    /   \
   +     +
   |     |
   +     +
    \   /
     +-+

or if you have a shape like

  +-+ +-+
  | | | |
  | *-* |
  +-----+

it has the following convex hull:

  +-----+
  |     |
  |     |
  +-----+

So, as it was stated by some other folks, you have to use the area of
the exterior rings of the polygon.

Markus


-- 
markus schaber | dipl. informatiker
logi-track ag | rennweg 14-16 | ch 8001 zürich
phone +41-43-888 62 52 | fax +41-43-888 62 53
mailto:schaber at logi-track.com | www.logi-track.com



More information about the postgis-users mailing list