<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Python: Calculate Area in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/python-calculate-area/m-p/494212#M16461</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Well,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I threw the whole add and calculate field part into a try/except block and it works now.&amp;nbsp; I didn't actually change any of the code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm happy that it works, but does anyone know why that would solve the problem?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;if wsType == "FileSystem":
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Intersect land cover and catchments
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.Intersect_Analysis (catchmentsFC + ";" + landCoverFC, "Intersect.shp", "ALL", "", "INPUT")
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Dissolve output based on catchment and land cover IDs
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.Dissolve_management ("Intersect.shp", "Dissolve.shp", "UCID; GRIDCODE", "", "MULTI_PART", "")
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Create a table, add and caculate the area
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.MakeTableView_management("Dissolve.shp", tableView, "", "", "UCID Catchment VISIBLE; GRIDCODE LandCov VISIBLE")
&amp;nbsp;&amp;nbsp;&amp;nbsp; LCArea = "LCArea"
&amp;nbsp;&amp;nbsp;&amp;nbsp; try:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.AddField_management (tableView, LCArea, "DOUBLE", "", "", "", "", "", "", "")&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; expression = "!SHAPE.AREA@SQUAREMETERS!"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fields = gp.ListFields (tableView)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.CalculateField_management (tableView, LCArea, expression, "PYTHON_9.3", "")
&amp;nbsp;&amp;nbsp;&amp;nbsp; except:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.GetMessages()
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Export the table to dBASE
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.TableToDbase_conversion (tableView, tableFolder)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 21:45:03 GMT</pubDate>
    <dc:creator>LornaMurison</dc:creator>
    <dc:date>2021-12-11T21:45:03Z</dc:date>
    <item>
      <title>Python: Calculate Area</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/python-calculate-area/m-p/494207#M16456</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi everyone,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is my daily python question just to keep you all on your toes...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would like to add a field called "LCArea" and calculate, you guessed it, the area.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;But I don't know what to put in the codeblock because I can only find area calculation codes in VBA.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I would appreciate some guidance as to how to use the expression and codeblock parameters.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And as a side note, when using the Advanced Field Calculator in ArcMap, it defaults to VBA.&amp;nbsp; How do I do field calculations using python in ArcMap?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;# If the output is a geodatabase feature class...
if outType == "FeatureClass":
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Then export the attribute table
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.MakeTableView_management(dissolveOutputFC, tableView, "", "", "UCID Catchment VISIBLE; GRIDCODE LandCov VISIBLE; Shape_Area LCArea VISIBLE")
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.TableToDbase_conversion (tableView, tableFolder)
# If the output is a shapefile...
elif outType == "ShapeFile":
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Then add and calculate an area field...
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.MakeTableView_management(dissolveOutputFC, tableView, "", "", "UCID Catchment VISIBLE; GRIDCODE LandCov VISIBLE")
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.AddField_management (tableView, "LCArea", "DOUBLE", "", "", "", "", "", "", "")
&amp;nbsp;&amp;nbsp;&amp;nbsp; expression =
&amp;nbsp;&amp;nbsp;&amp;nbsp; codeblock = 
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.CalculateField_management (tableView, "LCArea", expression, "PYTHON_9.3", codeblock)
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.TableToDbase_conversion (tableView, tableFolder)
&amp;nbsp;&amp;nbsp;&amp;nbsp; # And export the attribute table
#else:
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Error handler to exit the script and return some message
#print 'done'&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Nov 2010 14:27:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/python-calculate-area/m-p/494207#M16456</guid>
      <dc:creator>LornaMurison</dc:creator>
      <dc:date>2010-11-03T14:27:18Z</dc:date>
    </item>
    <item>
      <title>Re: Python: Calculate Area</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/python-calculate-area/m-p/494208#M16457</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There's a bunch of ways to do this, but I've found that the (new in v9.3) ESRI "unit keywords" are the easiest. For example (see the @ACRES part):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;gp.AddField_management(edgeDissolveFC, "ACRES", "DOUBLE", "", "", ""); showGpMessage()
gp.CalculateField_management(edgeDissolveFC, "ACRES", "!SHAPE.AREA@ACRES!", "PYTHON", ""); showGpMessage()&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For a list of all the keywords: &lt;/SPAN&gt;&lt;A href="http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?id=1812&amp;amp;pid=1808&amp;amp;topicname=Calculate_Field_(Data_Management" rel="nofollow noopener noreferrer" target="_blank"&gt;http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?id=1812&amp;amp;pid=1808&amp;amp;topicname=Calculate_Field_(Data_Management&lt;/A&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Some advice on using complex expressions in the codeblock thing: Don't do it! Instead, use an updatecursor. The syntax is MUCH easier, especially for complicated things. For example: &lt;/SPAN&gt;&lt;A href="http://forums.esri.com/Thread.asp?c=93&amp;amp;f=1729&amp;amp;t=262236#806786" rel="nofollow noopener noreferrer" target="_blank"&gt;http://forums.esri.com/Thread.asp?c=93&amp;amp;f=1729&amp;amp;t=262236#806786&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Per your last question: Use the CalculateField tool in the Toolbox. The "right-click calculate field tool" in the table GUI does not have the "PYTHON" option (at least in v9.3 it didn't.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:44:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/python-calculate-area/m-p/494208#M16457</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2021-12-11T21:44:58Z</dc:date>
    </item>
    <item>
      <title>Re: Python: Calculate Area</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/python-calculate-area/m-p/494209#M16458</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Version 10 does allow for the use of Python&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Nov 2010 16:09:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/python-calculate-area/m-p/494209#M16458</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2010-11-03T16:09:47Z</dc:date>
    </item>
    <item>
      <title>Re: Python: Calculate Area</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/python-calculate-area/m-p/494210#M16459</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There's a blog about this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/2009/03/06/Tips-and-tricks-_2D00_-accessing-feature-shape-in-Calculate-Field.aspx"&gt;http://blogs.esri.com/Dev/blogs/geoprocessing/archive/2009/03/06/Tips-and-tricks-_2D00_-accessing-feature-shape-in-Calculate-Field.aspx&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Nov 2010 18:03:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/python-calculate-area/m-p/494210#M16459</guid>
      <dc:creator>DaleHoneycutt</dc:creator>
      <dc:date>2010-11-03T18:03:48Z</dc:date>
    </item>
    <item>
      <title>Re: Python: Calculate Area</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/python-calculate-area/m-p/494211#M16460</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank-you,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Shape.Area worked while I was running the code in pythonwin.&amp;nbsp; I have now imported the code into a toolbox and it is no longer working.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In the code below, if tempWorkspace is a geodatabase the code works, if it's a file, then I get an error saying field "LCArea" does not exist within table.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Import Modules
import arcgisscripting
# Create Geoprocessor object
gp = arcgisscripting.create(9.3)
gp.overwriteoutput = True
# Set up parameters
catchmentsFC = gp.GetParameterAsText(0) #in a toolbox GUI, Type = FeatureLayer
landCoverFC = gp.GetParameterAsText(1) #in a toolbox GUI, Type = FeatureLayer
tempWorkspace = gp.GetParameterAsText (2) #in a toolbox GUI, Type = Workspace
tableFolder = gp.GetParameterAsText (3) #in a toolbox GUI, Type = Folder
tableName = gp.GetParameterAsText (4) #in a toolbox GUI, Type = String
tableView = tableFolder + "\\" + tableName
gp.Workspace = tempWorkspace
wsDesc = gp.Describe(tempWorkspace)
wsType = wsDesc.WorkspaceType
if wsType == "FileSystem":
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Intersect land cover and catchments
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.Intersect_Analysis (catchmentsFC + ";" + landCoverFC, "Intersect.shp", "ALL", "", "INPUT")
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Dissolve output based on catchment and land cover IDs
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.Dissolve_management ("Intersect.shp", "Dissolve.shp", "UCID; GRIDCODE", "", "MULTI_PART", "")
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Create a table, add and caculate the area
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.MakeTableView_management("Dissolve.shp", tableView, "", "", "UCID Catchment VISIBLE; GRIDCODE LandCov VISIBLE")
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.AddField_management (tableView, "LCArea", "DOUBLE", "", "", "", "", "", "", "")
&amp;nbsp;&amp;nbsp;&amp;nbsp; expression = "!SHAPE.AREA@SQUAREMETERS!"
&amp;nbsp;&amp;nbsp;&amp;nbsp; fields = gp.ListFields (tableView)
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.CalculateField_management (tableView, "LCArea", expression, "PYTHON_9.3", "")
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Export the table to dBASE
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.TableToDbase_conversion (tableView, tableFolder)&amp;nbsp;&amp;nbsp;&amp;nbsp; 
elif wsType == "LocalDatabase":
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.Intersect_Analysis (catchmentsFC + ";" + landCoverFC, "Intersect", "ALL", "", "INPUT")
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Dissolve output based on catchment and land cover IDs
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.Dissolve_management ("Intersect", "Dissolve", "UCID; GRIDCODE", "", "MULTI_PART", "")
&amp;nbsp;&amp;nbsp;&amp;nbsp; #desc = gp.Describe("Dissolve")
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.MakeTableView_management("Dissolve", tableView, "", "", "UCID Catchment VISIBLE; GRIDCODE LandCov VISIBLE; Shape_Area LCArea VISIBLE")
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.TableToDbase_conversion (tableView, tableFolder)
print 'done'&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:45:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/python-calculate-area/m-p/494211#M16460</guid>
      <dc:creator>LornaMurison</dc:creator>
      <dc:date>2021-12-11T21:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: Python: Calculate Area</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/python-calculate-area/m-p/494212#M16461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Well,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I threw the whole add and calculate field part into a try/except block and it works now.&amp;nbsp; I didn't actually change any of the code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm happy that it works, but does anyone know why that would solve the problem?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;if wsType == "FileSystem":
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Intersect land cover and catchments
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.Intersect_Analysis (catchmentsFC + ";" + landCoverFC, "Intersect.shp", "ALL", "", "INPUT")
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Dissolve output based on catchment and land cover IDs
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.Dissolve_management ("Intersect.shp", "Dissolve.shp", "UCID; GRIDCODE", "", "MULTI_PART", "")
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Create a table, add and caculate the area
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.MakeTableView_management("Dissolve.shp", tableView, "", "", "UCID Catchment VISIBLE; GRIDCODE LandCov VISIBLE")
&amp;nbsp;&amp;nbsp;&amp;nbsp; LCArea = "LCArea"
&amp;nbsp;&amp;nbsp;&amp;nbsp; try:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.AddField_management (tableView, LCArea, "DOUBLE", "", "", "", "", "", "", "")&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; expression = "!SHAPE.AREA@SQUAREMETERS!"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fields = gp.ListFields (tableView)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.CalculateField_management (tableView, LCArea, expression, "PYTHON_9.3", "")
&amp;nbsp;&amp;nbsp;&amp;nbsp; except:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.GetMessages()
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Export the table to dBASE
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.TableToDbase_conversion (tableView, tableFolder)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:45:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/python-calculate-area/m-p/494212#M16461</guid>
      <dc:creator>LornaMurison</dc:creator>
      <dc:date>2021-12-11T21:45:03Z</dc:date>
    </item>
    <item>
      <title>Re: Python: Calculate Area</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/python-calculate-area/m-p/494213#M16462</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;As it turns out, it didn't solve the problem.&amp;nbsp; The field "LCArea" is added, but it is not calculated, it remains filled with zeroes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;No messages are returned... at least not in the toolbox.&amp;nbsp; I don't really know where gp.GetMessages() is supposed to send its messages though...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Nov 2010 19:32:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/python-calculate-area/m-p/494213#M16462</guid>
      <dc:creator>LornaMurison</dc:creator>
      <dc:date>2010-11-04T19:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: Python: Calculate Area</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/python-calculate-area/m-p/494214#M16463</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;if it adds the field, what is the precision and scale?, have you tried to specify those parameters explicitly to ensure that any calculation will fit?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Nov 2010 19:37:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/python-calculate-area/m-p/494214#M16463</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2010-11-04T19:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: Python: Calculate Area</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/python-calculate-area/m-p/494215#M16464</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If I don't specify anything, the field that adds has a precision and scale of 0.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried specifying 10 and 9 and the resulting field had a precision of 18 and a scale of 9, still filled with zeroes.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Nov 2010 19:49:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/python-calculate-area/m-p/494215#M16464</guid>
      <dc:creator>LornaMurison</dc:creator>
      <dc:date>2010-11-04T19:49:42Z</dc:date>
    </item>
    <item>
      <title>Re: Python: Calculate Area</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/python-calculate-area/m-p/494216#M16465</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;When you put the try/except in, it didn't prevent the error from occuring, just hid it from you. Either remove the try/except or tweak the except part to make the error message visible (calling gp.getmessages() by itself just gobbles up the message without displaying it anywhere):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
except:
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.AddError(gp.GetMessages())&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:45:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/python-calculate-area/m-p/494216#M16465</guid>
      <dc:creator>LoganPugh</dc:creator>
      <dc:date>2021-12-11T21:45:06Z</dc:date>
    </item>
    <item>
      <title>Re: Python: Calculate Area</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/python-calculate-area/m-p/494217#M16466</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is your "shape" field called "shape"? Sometimes it isn't!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does this code populate values:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;gp.CalculateField_management(edgeDissolveFC, "ACRES", "!SHAPE.AREA!", "PYTHON", ""); showGpMessage()&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How about this code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;gp.CalculateField_management(edgeDissolveFC, "ACRES", "!" + gp.describe(edgeDissolveFC).shapefieldname + ".AREA@ACRES!", "PYTHON", ""); showGpMessage()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Nov 2010 23:33:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/python-calculate-area/m-p/494217#M16466</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2010-11-04T23:33:45Z</dc:date>
    </item>
    <item>
      <title>Re: Python: Calculate Area</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/python-calculate-area/m-p/494218#M16467</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Excellent!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank-you Chris, your second code snippet worked:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# Create a table, add and caculate the area
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.MakeTableView_management("Dissolve.shp", tableView, "", "", "UCID Catchment VISIBLE; GRIDCODE LandCov VISIBLE")
&amp;nbsp;&amp;nbsp;&amp;nbsp; LCArea = "LCArea"
&amp;nbsp;&amp;nbsp;&amp;nbsp; tableView = tableFolder + "\\" + tableName
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.AddField_management (tableView, LCArea, "DOUBLE", "#", "#", "", "LCArea", "NULLABLE", "NON_REQUIRED", "")&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.CalculateField_management("Dissolve.shp", LCArea, "!" + gp.describe("Dissolve.shp").shapefieldname + ".AREA@SQUAREMETERS!", "PYTHON", "")
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Export the table to dBASE
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.TableToDbase_conversion (tableView, tableFolder)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:45:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/python-calculate-area/m-p/494218#M16467</guid>
      <dc:creator>LornaMurison</dc:creator>
      <dc:date>2021-12-11T21:45:09Z</dc:date>
    </item>
  </channel>
</rss>

