<?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: Hi in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/calculate-polygon-area-perimeter-ratio/m-p/263316#M20312</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, well sure, beat me to a more elegant solution &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/laugh.png" /&gt;. The only caveat is if the OP isn't calculating a field, but getting the results for another process, as part of a more complex script. But your answer seems the most likely and best.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 Oct 2014 23:33:57 GMT</pubDate>
    <dc:creator>Zeke</dc:creator>
    <dc:date>2014-10-14T23:33:57Z</dc:date>
    <item>
      <title>Calculate polygon area perimeter ratio</title>
      <link>https://community.esri.com/t5/python-questions/calculate-polygon-area-perimeter-ratio/m-p/263313#M20309</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;I want to write a python script to calculate the edge to area ratio of each county in mi_counties.shp (Shape_Leng / Shape_Area). What would be the script look like with expression to calculate the ratio? Please help. Thank you!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(Curtis Price edited title, was "Hi")&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Oct 2014 20:57:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-polygon-area-perimeter-ratio/m-p/263313#M20309</guid>
      <dc:creator>NarayanKhatiwada1</dc:creator>
      <dc:date>2014-10-14T20:57:37Z</dc:date>
    </item>
    <item>
      <title>Re: Hi</title>
      <link>https://community.esri.com/t5/python-questions/calculate-polygon-area-perimeter-ratio/m-p/263314#M20310</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This can be done using the geometry column of the shapefile to return the length and area in the Calculate Field tool. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#/Using_the_Calculate_Field_tool/005s00000029000000/" title="http://resources.arcgis.com/en/help/main/10.1/index.html#/Using_the_Calculate_Field_tool/005s00000029000000/"&gt;ArcGIS Help 10.1&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_1413328655606368" jivemacro_uid="_1413328655606368" modifiedtitle="true"&gt;
&lt;P&gt;import arcpy&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;shp = r"&amp;lt;Path&amp;gt;\&amp;lt;ShapefileName&amp;gt;.shp"&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;arcpy.CalculateField_management(in_table=shp,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; field="EdgeRatio",&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; expression="!shape.length!/!shape.area!",&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; expression_type="PYTHON_9.3",&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; code_block="#")&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Oct 2014 23:20:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-polygon-area-perimeter-ratio/m-p/263314#M20310</guid>
      <dc:creator>ChristianWells</dc:creator>
      <dc:date>2014-10-14T23:20:34Z</dc:date>
    </item>
    <item>
      <title>Re: Hi</title>
      <link>https://community.esri.com/t5/python-questions/calculate-polygon-area-perimeter-ratio/m-p/263315#M20311</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Narayan. The script you want, or at least the formula you gave, is pretty simple. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14133284934769414" jivemacro_uid="_14133284934769414" modifiedtitle="true"&gt;
&lt;P&gt;def CalcRatio(len, area):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return len/area&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The differences in how you call this depend on whether you want to call this in Field Calculator or a stand alone script.&lt;/P&gt;&lt;P&gt;In FC, set the parser to python and check the show codeblock box. Enter the above code in the pre-logic box, and in the field = box&amp;nbsp; call the function as shown below (obviously use your own field names, not my example).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.esri.com/legacyfs/online/21141_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You'd use the same def in a stand alone script, but the method for getting the field values for length and area are a little different. If that's what you want, post back and we can go through that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Oct 2014 23:27:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-polygon-area-perimeter-ratio/m-p/263315#M20311</guid>
      <dc:creator>Zeke</dc:creator>
      <dc:date>2014-10-14T23:27:31Z</dc:date>
    </item>
    <item>
      <title>Re: Hi</title>
      <link>https://community.esri.com/t5/python-questions/calculate-polygon-area-perimeter-ratio/m-p/263316#M20312</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, well sure, beat me to a more elegant solution &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/laugh.png" /&gt;. The only caveat is if the OP isn't calculating a field, but getting the results for another process, as part of a more complex script. But your answer seems the most likely and best.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Oct 2014 23:33:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-polygon-area-perimeter-ratio/m-p/263316#M20312</guid>
      <dc:creator>Zeke</dc:creator>
      <dc:date>2014-10-14T23:33:57Z</dc:date>
    </item>
    <item>
      <title>Re: Hi</title>
      <link>https://community.esri.com/t5/python-questions/calculate-polygon-area-perimeter-ratio/m-p/263317#M20313</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Greg and Christian, thank you so much! I will try using both of these codes and let you know later. Thank you again.&lt;A _jive_internal="true" href="https://community.esri.com/people/recurvata"&gt;Greg Keith&lt;/A&gt;‌ and &lt;A _jive_internal="true" href="https://community.esri.com/people/Christian_Wells-esristaff"&gt;Christian Wells&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Oct 2014 02:31:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-polygon-area-perimeter-ratio/m-p/263317#M20313</guid>
      <dc:creator>NarayanKhatiwada1</dc:creator>
      <dc:date>2014-10-16T02:31:39Z</dc:date>
    </item>
  </channel>
</rss>

