ananasinka

Script to compare of 3 shapes by the largest total area

Discussion created by ananasinka on Aug 24, 2011
Latest reply on Aug 24, 2011 by ananasinka
Hello Forum,

I'm a newbie and need your help to write a (simple?) python-script..

My idea is so:
The script must take three shapes as input, read from all three shapes the column with area (all three shapes have the same structure and attribute names, features are polygons), compute the summary area for each shape and return as output the shape, which has the largest area.

Unfortunatelly I have no experience with python, so I'm not able to write the script myself. Can you help me to write the main steps?

I can imagine the algorithm of my task very well, but I do not know how to describe it in python syntax.

So, the algorithm:
Input: Shape1 as s1, Shape2 as s2, Shape3 as s3
For s1, s2 und s3 read the column "area" and compute the "Sumarea"
If s1.sumarea>s2.sumarea and s1.sumarea>s3.sumarea then Output = s1
else if s2.sumarea>s3.sumarea and s2.sumarea>s1.sumarea then Output = s2
else Output = s3

Thanking you in anticipation.

Best regards,
Ananasinka

Outcomes