If its not there, add a column to hold the percentage via table
>maintenance>structure.  For this discussion it will be called
Percentage_Of_Total

Then a 2 part SQL.

step one determine total area (I used square meters here, Mate)
In SQL builder:
Choose your polygon table in the table section
replace the * in the first section with Sum(Area(obj, "sq m")) sq m can be
replaced with other units

MapBasic window shows:
Select Sum(Area(obj, "sq m")) from MyTable into Selection
Browse * From Selection

the result will be one record giving the sum of the areas of all polys from
your table.  It is not necessary to Group By Objects.  Note that the units
of your existing individual area column and units of the query for total
area must match.

copy the figure returned above.

I used an existing table of polygons I have and it returned 22956 for the
sum of area(obj, "sq m"), we'll use that number in our next formula.

then run an column update wizard (Table>Update Column):
column to update is Percentage_Of_Total column you added above
hit the assist button and build a formula to divide the individual object's
area by the total area figure obtained in step one. The basic formula would
then be Area (obj, "sq m") /  total area.  Notice that although you have a
column for the individual objects' area, it is not necessary, the function
Area() will return these figures without an actual column.

So far, this procedure gives you decimals with no formatting for
percentages, and MI has no Percent data type or functions.

to get to a column of percentage, try this:

Update MyTable Set Percentage_of_Total = Round((Area(obj, "sq m") /
22956)*100, .001) +" %"

*100 converts the decimal to a percentage, it needs to be rounded to the
nearest 1/1000th to be workable, and the + " %" concatenates the percent
symbol into the figure, notice it is quote space % end quote to give a space
between the numbers and the % sign.


William "Woody" Woodruff
Zoning Administrator
Charter Township of Union, Isabella County, Michigan
-84.80947000 43.61095100
2010 S Lincoln Rd, Mt. Pleasant, MI  48858
(989) 772 4600 EXT 41
Visit our web site at http://www.geocities.com/ctuzoning/index.htm


-----Original Message-----
From: Peter Hatton [mailto:[EMAIL PROTECTED]
Sent: September 27, 2004 02:13
To: '[EMAIL PROTECTED]'
Subject: MI-L PERCENTAGE QUERY



               Hi all,
                               Can someone help me to do the following -

                                             I have a table of polygons with
individual area totals for each polygon.    Can someone tell me how I can
determine the area percentage of each polygon for the combined total area ?

                                       Many thanks
                                                       Peter

Peter HATTON
GIS Officer
Greater Taree City Council
PO Box 482 TAREE    2430
Ph   02 6592 5227
Fax   02 6592 5380
E-mail    [EMAIL PROTECTED]


This e-mail has been scanned for viruses by MCI's Internet Managed
Scanning Services - powered by MessageLabs. For further information
visit http://www.mci.com

---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 13513



---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 13529

Reply via email to