<?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: Problem - Zero length and area for polygon generated with Python script using insert cursor to ArcPro map in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/problem-zero-length-and-area-for-polygon-generated/m-p/1102708#M62559</link>
    <description>&lt;P&gt;David and Don, you are right.&amp;nbsp; I was using a State Plane Coordinate System, which is a projected coordinate system, but using Lat/Long coordinates I need a geographic coordinate system like NAD 83.&amp;nbsp; Thank you!&lt;/P&gt;</description>
    <pubDate>Tue, 28 Sep 2021 18:06:19 GMT</pubDate>
    <dc:creator>DougEaton</dc:creator>
    <dc:date>2021-09-28T18:06:19Z</dc:date>
    <item>
      <title>Problem - Zero length and area for polygon generated with Python script using insert cursor to ArcPro map</title>
      <link>https://community.esri.com/t5/python-questions/problem-zero-length-and-area-for-polygon-generated/m-p/1102579#M62552</link>
      <description>&lt;P&gt;I'm having a problem with the following script.&amp;nbsp; It writes the feature successfully with all of the attributes, but it does not draw the polygon, as the shape length and area are both zero.&amp;nbsp; This script worked previously with ArcPro 2.5, but that project became corrupted so I re-created it in ArcPro 2.8.&amp;nbsp; I'm not sure that has anything to do with the issue.&lt;/P&gt;&lt;P&gt;In reading other posts, it appears the two most significant factors for this script to work are setting the spatial reference and also using "Shape@" to write the polygon coordinates from the array.&amp;nbsp; The spatial reference of the map and the feature class are the same- "NAD 1983 (2011) StatePlane Illinois East FIPS 1201 (US Feet)."&lt;/P&gt;&lt;P&gt;Any help is very much appreciated.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;arcpy&lt;BR /&gt;&lt;BR /&gt;NWLongitude = &lt;SPAN&gt;41.936811&lt;BR /&gt;&lt;/SPAN&gt;NWLatitude = -&lt;SPAN&gt;88.754027&lt;BR /&gt;&lt;/SPAN&gt;NELongitude = &lt;SPAN&gt;41.936811&lt;BR /&gt;&lt;/SPAN&gt;NELatitude = -&lt;SPAN&gt;88.750635&lt;BR /&gt;&lt;/SPAN&gt;SWLongitude = &lt;SPAN&gt;41.934087&lt;BR /&gt;&lt;/SPAN&gt;SWLatitude = -&lt;SPAN&gt;88.754027&lt;BR /&gt;&lt;/SPAN&gt;SELongitude = &lt;SPAN&gt;41.934087&lt;BR /&gt;&lt;/SPAN&gt;SELatitude = -&lt;SPAN&gt;88.750635&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;Item = &lt;SPAN&gt;"Test Area"&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;fc = &lt;SPAN&gt;r'G:\Arc\ArcPro\Public Works\MyProject6\MyProject6.gdb\Test_Polygon'&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;# Important: the spatial reference must be set, or the geometry will not locate properly.&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;sr = arcpy.Describe(fc).spatialReference  &lt;SPAN&gt;# ***Since Lat/Long Coordinates are provided, need Geographic&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;print&lt;/SPAN&gt;(&lt;SPAN&gt;"{0} : {1}"&lt;/SPAN&gt;.format(fc&lt;SPAN&gt;, &lt;/SPAN&gt;sr.name))&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Define the coordinate array for the 4-point polygon that is passed to the feature to map it.&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;# Note that the feature is plotted with the 4 points in a clockwise direction - NW, NE, SE, SW.&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;coordinateArray = arcpy.Array([arcpy.Point(NWLongitude&lt;SPAN&gt;, &lt;/SPAN&gt;NWLatitude)&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;                               arcpy.Point(NELongitude&lt;SPAN&gt;, &lt;/SPAN&gt;NELatitude)&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;                               arcpy.Point(SELongitude&lt;SPAN&gt;, &lt;/SPAN&gt;SELatitude)&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;                               arcpy.Point(SWLongitude&lt;SPAN&gt;, &lt;/SPAN&gt;SWLatitude)])&lt;BR /&gt;polygon = arcpy.Polygon(coordinateArray&lt;SPAN&gt;, &lt;/SPAN&gt;sr)&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Create Insert Cursor to write feature using polygon coordinateArray above.&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;# "SHAPE@" is a special designation that passes through the polygon geometry statement directly above.&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;# Note that these are the exact field names in the Test_Polygon feature.&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;cursorFC = arcpy.da.InsertCursor(fc&lt;SPAN&gt;, &lt;/SPAN&gt;[&lt;SPAN&gt;"SHAPE@"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"NWlat"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"NWlong"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"NElat"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"NElong"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"SWlat"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"SWlong"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"SElat"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;                                      &lt;SPAN&gt;"SElong"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"Item"&lt;/SPAN&gt;])&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Loading the variables&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;cursorFC.insertRow(&lt;BR /&gt;    [polygon&lt;SPAN&gt;, &lt;/SPAN&gt;NWLatitude&lt;SPAN&gt;, &lt;/SPAN&gt;NWLongitude&lt;SPAN&gt;, &lt;/SPAN&gt;NELatitude&lt;SPAN&gt;, &lt;/SPAN&gt;NELongitude&lt;SPAN&gt;, &lt;/SPAN&gt;SWLatitude&lt;SPAN&gt;, &lt;/SPAN&gt;SWLongitude&lt;SPAN&gt;, &lt;/SPAN&gt;SELatitude&lt;SPAN&gt;, &lt;/SPAN&gt;SELongitude&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;     Item])&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#  Delete cursor object &lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;del &lt;/SPAN&gt;cursorFC&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 14:40:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-zero-length-and-area-for-polygon-generated/m-p/1102579#M62552</guid>
      <dc:creator>DougEaton</dc:creator>
      <dc:date>2021-09-28T14:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: Problem - Zero length and area for polygon generated with Python script using insert cursor to ArcPro map</title>
      <link>https://community.esri.com/t5/python-questions/problem-zero-length-and-area-for-polygon-generated/m-p/1102581#M62554</link>
      <description>&lt;P&gt;Sorry I've not checked the script thoroughly, but it seems that you've not closed the polygon (clockwise array should end with a repeat of the first coordinates).&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 14:44:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-zero-length-and-area-for-polygon-generated/m-p/1102581#M62554</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-09-28T14:44:48Z</dc:date>
    </item>
    <item>
      <title>Re: Problem - Zero length and area for polygon generated with Python script using insert cursor to ArcPro map</title>
      <link>https://community.esri.com/t5/python-questions/problem-zero-length-and-area-for-polygon-generated/m-p/1102593#M62555</link>
      <description>&lt;P&gt;Thank you for the suggestion David.&amp;nbsp; I changed the code to add the first coordinate pair again at the end, however I am getting the same result.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 15:04:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-zero-length-and-area-for-polygon-generated/m-p/1102593#M62555</guid>
      <dc:creator>DougEaton</dc:creator>
      <dc:date>2021-09-28T15:04:17Z</dc:date>
    </item>
    <item>
      <title>Re: Problem - Zero length and area for polygon generated with Python script using insert cursor to ArcPro map</title>
      <link>https://community.esri.com/t5/python-questions/problem-zero-length-and-area-for-polygon-generated/m-p/1102630#M62556</link>
      <description>&lt;P&gt;Oh wait, what's up with the projection? The geometry has to be in the same units as the projection, you cant just use lat longs, or am I missing something?&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 15:42:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-zero-length-and-area-for-polygon-generated/m-p/1102630#M62556</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-09-28T15:42:42Z</dc:date>
    </item>
    <item>
      <title>Re: Problem - Zero length and area for polygon generated with Python script using insert cursor to ArcPro map</title>
      <link>https://community.esri.com/t5/python-questions/problem-zero-length-and-area-for-polygon-generated/m-p/1102697#M62557</link>
      <description>&lt;P&gt;Your code worked OK for me when I ran it against a feature class with a spatial reference whose unit of measure was degrees (NAD 1983).&amp;nbsp; At least the polygon that it generated looks correct.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 17:37:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-zero-length-and-area-for-polygon-generated/m-p/1102697#M62557</guid>
      <dc:creator>DonMorrison1</dc:creator>
      <dc:date>2021-09-28T17:37:13Z</dc:date>
    </item>
    <item>
      <title>Re: Problem - Zero length and area for polygon generated with Python script using insert cursor to ArcPro map</title>
      <link>https://community.esri.com/t5/python-questions/problem-zero-length-and-area-for-polygon-generated/m-p/1102708#M62559</link>
      <description>&lt;P&gt;David and Don, you are right.&amp;nbsp; I was using a State Plane Coordinate System, which is a projected coordinate system, but using Lat/Long coordinates I need a geographic coordinate system like NAD 83.&amp;nbsp; Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 18:06:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-zero-length-and-area-for-polygon-generated/m-p/1102708#M62559</guid>
      <dc:creator>DougEaton</dc:creator>
      <dc:date>2021-09-28T18:06:19Z</dc:date>
    </item>
  </channel>
</rss>

