<?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: How Can I Calculate the Length and Width of a Polygon Using ArcPy in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-can-i-calculate-the-length-and-width-of-a/m-p/191293#M14692</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks I got it&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 May 2014 06:58:16 GMT</pubDate>
    <dc:creator>OLANIYANOLAKUNLE</dc:creator>
    <dc:date>2014-05-06T06:58:16Z</dc:date>
    <item>
      <title>How Can I Calculate the Length and Width of a Polygon Using ArcPy</title>
      <link>https://community.esri.com/t5/python-questions/how-can-i-calculate-the-length-and-width-of-a/m-p/191290#M14689</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;How Can I Calculate the Length and Width of a Polygon Using ArcPy any suggestion(s). Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 May 2014 23:02:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-can-i-calculate-the-length-and-width-of-a/m-p/191290#M14689</guid>
      <dc:creator>OLANIYANOLAKUNLE</dc:creator>
      <dc:date>2014-05-04T23:02:38Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I Calculate the Length and Width of a Polygon Using ArcPy</title>
      <link>https://community.esri.com/t5/python-questions/how-can-i-calculate-the-length-and-width-of-a/m-p/191291#M14690</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Well, it depends on the type of polygon and orientation - do you mean a rectangular polygon?&amp;nbsp; Minimum bounding geometry is one way, see this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//00170000003q000000"&gt;http://resources.arcgis.com/en/help/main/10.2/index.html#//00170000003q000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The graphic row for polygon shows the various geometry methods - check out RECTANGLE_BY_WIDTH, RECTANGLE_BY_AREA, and ENVELOPE.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, there's the convex hull property 'getHullRectangle' --- gives you a space-delimited coordinate pair string of the vertices.&amp;nbsp; You can use the distance formula to back out the height/width if not oriented 'orthogonally' to the x/y axes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//018z00000061000000"&gt;http://resources.arcgis.com/en/help/main/10.2/index.html#//018z00000061000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT- Python has a math module with trig functions that will help too.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...specifically related to the distance formula:&amp;nbsp; math.hypot(x,y)&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="https://docs.python.org/2.7/library/math.html#trigonometric-functions"&gt;https://docs.python.org/2.7/library/math.html#trigonometric-functions&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 May 2014 00:50:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-can-i-calculate-the-length-and-width-of-a/m-p/191291#M14690</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2014-05-05T00:50:42Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I Calculate the Length and Width of a Polygon Using ArcPy</title>
      <link>https://community.esri.com/t5/python-questions/how-can-i-calculate-the-length-and-width-of-a/m-p/191292#M14691</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Also try....&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://www.arcgis.com/home/item.html?id=564e2949763943e3b9fb4240bab0ca2f"&gt;http://www.arcgis.com/home/item.html?id=564e2949763943e3b9fb4240bab0ca2f&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 May 2014 00:58:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-can-i-calculate-the-length-and-width-of-a/m-p/191292#M14691</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-05-05T00:58:07Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I Calculate the Length and Width of a Polygon Using ArcPy</title>
      <link>https://community.esri.com/t5/python-questions/how-can-i-calculate-the-length-and-width-of-a/m-p/191293#M14692</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks I got it&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2014 06:58:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-can-i-calculate-the-length-and-width-of-a/m-p/191293#M14692</guid>
      <dc:creator>OLANIYANOLAKUNLE</dc:creator>
      <dc:date>2014-05-06T06:58:16Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I Calculate the Length and Width of a Polygon Using ArcPy</title>
      <link>https://community.esri.com/t5/python-questions/how-can-i-calculate-the-length-and-width-of-a/m-p/191294#M14693</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here's some v10.1+ code that calculates an "aspect ratio" in regards to a poly or line FC's hull rectangle (not the same as extent rectangle BTW)... The variables "distance1" and "distance2" are length and width (depending on which one is the longer distance):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;arcpy.AddField_management(indxTileSinglePartFC, "ASP_RATIO", "DOUBLE")
updateRows = arcpy.da.UpdateCursor(indxTileSinglePartFC, ["SHAPE@","ASP_RATIO"])
for updateRow in updateRows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; shapeObj = updateRow[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp; x1,y1,x2,y2,x3,y3,x4,y4 = [float(coord) for coord in shapeObj.hullRectangle.split(" ")]
&amp;nbsp;&amp;nbsp;&amp;nbsp; distance1 = math.sqrt((x1 - x2)**2 + (y1 - y2)**2)
&amp;nbsp;&amp;nbsp;&amp;nbsp; distance2 = math.sqrt((x2 - x3)**2 + (y2 - y3)**2)
&amp;nbsp;&amp;nbsp;&amp;nbsp; if distance1 &amp;lt;= distance2:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[1] = distance2 / distance1
&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[1] = distance1 / distance2
&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRows.updateRow(updateRow)
del updateRow, updateRows&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:37:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-can-i-calculate-the-length-and-width-of-a/m-p/191294#M14693</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2021-12-11T09:37:08Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I Calculate the Length and Width of a Polygon Using ArcPy</title>
      <link>https://community.esri.com/t5/python-questions/how-can-i-calculate-the-length-and-width-of-a/m-p/191295#M14694</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Nice Chris!- and incidentally (if I'm not mistaken), the 'distance' lines can be shortened to use the hypot function...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In other words:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
distance1 = math.sqrt((x1 - x2)**2 + (y1 - y2)**2)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;...is equivalently:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
distance1 = math.hypot((x1 - x2), (y1 - y2))
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:37:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-can-i-calculate-the-length-and-width-of-a/m-p/191295#M14694</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2021-12-11T09:37:10Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I Calculate the Length and Width of a Polygon Using ArcPy</title>
      <link>https://community.esri.com/t5/python-questions/how-can-i-calculate-the-length-and-width-of-a/m-p/191296#M14695</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;math.hypot... Cool - I'll have to use that from now on!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2014 15:48:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-can-i-calculate-the-length-and-width-of-a/m-p/191296#M14695</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2014-05-06T15:48:49Z</dc:date>
    </item>
  </channel>
</rss>

