<?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 Create Polygons from Lat and Long coordinates through Python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/create-polygons-from-lat-and-long-coordinates/m-p/761251#M58712</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello, &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a problem. I want to create polygons by using the X and Y values from a CSV file. I have borrowed a script and edited to work with my data. The only problem is the script runs for only one set of values. Not both. I have a location and from the location it draws a polygon that is 20000 square feet and it does not recognise the second set of coordinates. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I believe I am missing a split line? Or not.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy, csv, os&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from arcpy import env&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;env.overwriteOutput = True&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;infile = "U:\Tax\Special Projects\JEFitzgerald\CUVA\Test\XY_EVENT_.csv"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;point = arcpy.Point()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;array = arcpy.Array()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;featureList= []&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;curXY = arcpy.da.SearchCursor(infile, ["X","Y"])&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for row in curXY:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; X = float (row[1])&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Y = float (row[0])&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; highX = X+ 148.7&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; highY = Y + 134.5&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; array = arcpy.Array([arcpy.Point(X, Y), arcpy.Point(highX, Y),&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Point(highX, highY), arcpy.Point(X, highY), arcpy.Point(X, Y)])&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;polygon = arcpy.Polygon(array)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;featureList.append(polygon)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.CopyFeatures_management(featureList, "U:\Tax\Special Projects\JEFitzgerald\CUVA\Test\Test_CUVA.gdb\Poly33")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;print arcpy.GetMessages()&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 08 Apr 2014 20:28:52 GMT</pubDate>
    <dc:creator>JamesFitzgerald</dc:creator>
    <dc:date>2014-04-08T20:28:52Z</dc:date>
    <item>
      <title>Create Polygons from Lat and Long coordinates through Python</title>
      <link>https://community.esri.com/t5/python-questions/create-polygons-from-lat-and-long-coordinates/m-p/761251#M58712</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello, &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a problem. I want to create polygons by using the X and Y values from a CSV file. I have borrowed a script and edited to work with my data. The only problem is the script runs for only one set of values. Not both. I have a location and from the location it draws a polygon that is 20000 square feet and it does not recognise the second set of coordinates. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I believe I am missing a split line? Or not.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy, csv, os&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from arcpy import env&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;env.overwriteOutput = True&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;infile = "U:\Tax\Special Projects\JEFitzgerald\CUVA\Test\XY_EVENT_.csv"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;point = arcpy.Point()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;array = arcpy.Array()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;featureList= []&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;curXY = arcpy.da.SearchCursor(infile, ["X","Y"])&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for row in curXY:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; X = float (row[1])&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Y = float (row[0])&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; highX = X+ 148.7&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; highY = Y + 134.5&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; array = arcpy.Array([arcpy.Point(X, Y), arcpy.Point(highX, Y),&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Point(highX, highY), arcpy.Point(X, highY), arcpy.Point(X, Y)])&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;polygon = arcpy.Polygon(array)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;featureList.append(polygon)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.CopyFeatures_management(featureList, "U:\Tax\Special Projects\JEFitzgerald\CUVA\Test\Test_CUVA.gdb\Poly33")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;print arcpy.GetMessages()&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Apr 2014 20:28:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/create-polygons-from-lat-and-long-coordinates/m-p/761251#M58712</guid>
      <dc:creator>JamesFitzgerald</dc:creator>
      <dc:date>2014-04-08T20:28:52Z</dc:date>
    </item>
    <item>
      <title>Re: Create Polygons from Lat and Long coordinates through Python</title>
      <link>https://community.esri.com/t5/python-questions/create-polygons-from-lat-and-long-coordinates/m-p/761252#M58713</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Can you re-post your code using the CODE wrap button (once you highlight all the code, press the button with the pound sign) so that we can see the indentation you're using?&amp;nbsp; Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2014 00:34:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/create-polygons-from-lat-and-long-coordinates/m-p/761252#M58713</guid>
      <dc:creator>WilliamCraft</dc:creator>
      <dc:date>2014-04-09T00:34:20Z</dc:date>
    </item>
    <item>
      <title>Re: Create Polygons from Lat and Long coordinates through Python</title>
      <link>https://community.esri.com/t5/python-questions/create-polygons-from-lat-and-long-coordinates/m-p/761253#M58714</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, csv, os
from arcpy import env

env.overwriteOutput = True
infile = "U:\Tax\Special Projects\JEFitzgerald\CUVA\Test\XY_EVENT_.csv"



point = arcpy.Point()
array = arcpy.Array()
featureList= []

curXY = arcpy.da.SearchCursor(infile, ["X","Y"])





for row in curXY:
&amp;nbsp;&amp;nbsp;&amp;nbsp; X = float (row[1])
&amp;nbsp;&amp;nbsp;&amp;nbsp; Y = float (row[0])
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; highX = X+ 148.7
&amp;nbsp;&amp;nbsp;&amp;nbsp; highY = Y + 134.5
&amp;nbsp;&amp;nbsp;&amp;nbsp; array = arcpy.Array([arcpy.Point(X, Y), arcpy.Point(highX, Y),
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Point(highX, highY), arcpy.Point(X, highY), arcpy.Point(X, Y)])

polygon = arcpy.Polygon(array)
featureList.append(polygon)

arcpy.CopyFeatures_management(featureList, "U:\Tax\Special Projects\JEFitzgerald\CUVA\Test\Test_CUVA.gdb\Poly33")


&amp;nbsp;&amp;nbsp;&amp;nbsp; 

print arcpy.GetMessages()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 08:21:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/create-polygons-from-lat-and-long-coordinates/m-p/761253#M58714</guid>
      <dc:creator>JamesFitzgerald</dc:creator>
      <dc:date>2021-12-12T08:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: Create Polygons from Lat and Long coordinates through Python</title>
      <link>https://community.esri.com/t5/python-questions/create-polygons-from-lat-and-long-coordinates/m-p/761254#M58715</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;From looking at your code, I've made my suggested changes below in bold:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy, csv, os from arcpy import env&amp;nbsp; env.overwriteOutput = True infile = "U:\Tax\Special Projects\JEFitzgerald\CUVA\Test\XY_EVENT_.csv"&amp;nbsp; point = arcpy.Point() array = arcpy.Array() featureList= []&amp;nbsp; curXY = arcpy.da.SearchCursor(infile, ["X","Y"])&amp;nbsp; for row in curXY: &amp;nbsp;&amp;nbsp;&amp;nbsp; X = float (row[1]) &amp;nbsp;&amp;nbsp;&amp;nbsp; Y = float (row[0]) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; highX = X+ 148.7 &amp;nbsp;&amp;nbsp;&amp;nbsp; highY = Y + 134.5 &amp;nbsp;&amp;nbsp;&amp;nbsp; array = arcpy.Array([arcpy.Point(X, Y), arcpy.Point(highX, Y), &amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Point(highX, highY), arcpy.Point(X, highY), arcpy.Point(X, Y)])&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; polygon = arcpy.Polygon(array) &amp;nbsp;&amp;nbsp;&amp;nbsp; featureList.append(polygon)&amp;nbsp; arcpy.CopyFeatures_management(featureList, "U:\Tax\Special Projects\JEFitzgerald\CUVA\Test\Test_CUVA.gdb\Poly33")&amp;nbsp; print arcpy.GetMessages()&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think if you indent the two bolded lines above,then each time you construct your array to generate a polygon you will append it to the feature list.&amp;nbsp; After iterating through all of the curXY rows in your CSV, you can execute one CopyFeatures operation (as you're already doing) to push everything from the feature list to the file geodatabase.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2014 10:41:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/create-polygons-from-lat-and-long-coordinates/m-p/761254#M58715</guid>
      <dc:creator>WilliamCraft</dc:creator>
      <dc:date>2014-04-09T10:41:26Z</dc:date>
    </item>
    <item>
      <title>Re: Create Polygons from Lat and Long coordinates through Python</title>
      <link>https://community.esri.com/t5/python-questions/create-polygons-from-lat-and-long-coordinates/m-p/761255#M58716</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you very much! Your suggestion worked! It also will save me a great deal of time!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;J&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2014 14:32:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/create-polygons-from-lat-and-long-coordinates/m-p/761255#M58716</guid>
      <dc:creator>JamesFitzgerald</dc:creator>
      <dc:date>2014-04-09T14:32:53Z</dc:date>
    </item>
    <item>
      <title>Re: Create Polygons from Lat and Long coordinates through Python</title>
      <link>https://community.esri.com/t5/python-questions/create-polygons-from-lat-and-long-coordinates/m-p/761256#M58717</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Great, glad to hear it!&amp;nbsp; Please mark the correct answer with the green check.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2014 14:33:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/create-polygons-from-lat-and-long-coordinates/m-p/761256#M58717</guid>
      <dc:creator>WilliamCraft</dc:creator>
      <dc:date>2014-04-09T14:33:42Z</dc:date>
    </item>
  </channel>
</rss>

