<?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: Creating polyline from text file in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56417#M4478</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;your polyline line 09 needs to be completely dedented&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 12 Feb 2016 20:22:58 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2016-02-12T20:22:58Z</dc:date>
    <item>
      <title>Creating polyline from text file</title>
      <link>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56414#M4475</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;CODE&gt;&lt;SPAN class="pln" style="color: black;"&gt;So I need to create a line based on a series of points. In the example below, there are 4 lines to be created, Line_1. Line_2, etc. Struggling with the loop that creates each pointList.&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;cursor = arcpy.da.InsertCursor(fc, ["Name","SHAPE@"])
&amp;nbsp;&amp;nbsp; 
for ln in inputFile:
&amp;nbsp; name = ln[0]
&amp;nbsp; pointList = Point. Array() # initial Array
&amp;nbsp;&amp;nbsp;&amp;nbsp; ln = line.split(",") # Split the lines in text file
&amp;nbsp;&amp;nbsp;&amp;nbsp; point = arcpy.Point(ln[1], ln[2]) # Create points 
&amp;nbsp;&amp;nbsp;&amp;nbsp; pointList.add(point) # Add points to array
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; polyline = arcpy.Polyline(pointList)
cursor.insertRow(name, polyline)&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="typ" style="color: #2b91af;"&gt;&lt;CODE&gt;&lt;SPAN class="typ" style="color: #2b91af;"&gt;Line_1&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: maroon;"&gt;529018.125025&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: maroon;"&gt;4108038.05548&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="typ" style="color: #2b91af;"&gt;Line_1&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: maroon;"&gt;529005.718792&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: maroon;"&gt;4108028.20659&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="typ" style="color: #2b91af;"&gt;Line_1&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: maroon;"&gt;528993.340503&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: maroon;"&gt;4108018.73931&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="typ" style="color: #2b91af;"&gt;Line_1&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: maroon;"&gt;528980.990158&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: maroon;"&gt;4108009.65364&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="typ" style="color: #2b91af;"&gt;Line_1&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: maroon;"&gt;528968.667757&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: maroon;"&gt;4108000.94958&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="typ" style="color: #2b91af;"&gt;Line_2&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: maroon;"&gt;528956.373301&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: maroon;"&gt;4107992.62713&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="typ" style="color: #2b91af;"&gt;Line_2&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: maroon;"&gt;528944.106788&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: maroon;"&gt;4107984.68629&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="typ" style="color: #2b91af;"&gt;Line_2&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: maroon;"&gt;528931.86822&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: maroon;"&gt;4107977.12705&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="typ" style="color: #2b91af;"&gt;Line_3&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: maroon;"&gt;528919.657595&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: maroon;"&gt;4107969.94943&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="typ" style="color: #2b91af;"&gt;Line_3&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: maroon;"&gt;528907.474915&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: maroon;"&gt;4107963.15341&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="typ" style="color: #2b91af;"&gt;Line_3&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: maroon;"&gt;528895.320179&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: maroon;"&gt;4107956.739&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="typ" style="color: #2b91af;"&gt;Line_3&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: maroon;"&gt;528883.193387&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: maroon;"&gt;4107950.7062&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="typ" style="color: #2b91af;"&gt;Line_4&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: maroon;"&gt;528871.09454&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: maroon;"&gt;4107945.055&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="typ" style="color: #2b91af;"&gt;Line_4&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: maroon;"&gt;528859.023636&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: maroon;"&gt;4107939.78542&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="typ" style="color: #2b91af;"&gt;Line_4&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: maroon;"&gt;528846.980676&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: maroon;"&gt;4107934.89744&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="typ" style="color: #2b91af;"&gt;Line_4&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: maroon;"&gt;528834.965661&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: maroon;"&gt;4107930.39107&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:08:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56414#M4475</guid>
      <dc:creator>KennethKirkeby</dc:creator>
      <dc:date>2021-12-10T22:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: Creating polyline from text file</title>
      <link>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56415#M4476</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please post your entire script with code formatting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migration-blogpost/1070"&gt;Posting Code blocks in the new GeoNet&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edit: you reference ln[0] before creating the ln variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edit 2: not sure what this line means: &lt;SPAN class="pln" style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; color: black;"&gt;Pointillist &lt;/SPAN&gt;&lt;SPAN class="pun" style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln" style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; color: black;"&gt; occupies&lt;/SPAN&gt;&lt;SPAN class="pun" style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; color: black;"&gt;. &lt;/SPAN&gt;&lt;SPAN class="typ" style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; color: #2b91af;"&gt;Array&lt;/SPAN&gt;&lt;SPAN class="pun" style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; color: black;"&gt; () # initial Array&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pun" style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; color: black;"&gt;Should probably be: pointList = arcpy.Array()&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pun" style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; color: black;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pun" style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; color: black;"&gt;edit 3: your variable names need to match exactly. Pointllist &amp;lt;&amp;gt; pointList&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Feb 2016 19:50:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56415#M4476</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2016-02-12T19:50:54Z</dc:date>
    </item>
    <item>
      <title>Re: Creating polyline from text file</title>
      <link>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56416#M4477</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Corrected code and formatting, I hope.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Feb 2016 20:17:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56416#M4477</guid>
      <dc:creator>KennethKirkeby</dc:creator>
      <dc:date>2016-02-12T20:17:35Z</dc:date>
    </item>
    <item>
      <title>Re: Creating polyline from text file</title>
      <link>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56417#M4478</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;your polyline line 09 needs to be completely dedented&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Feb 2016 20:22:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56417#M4478</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-02-12T20:22:58Z</dc:date>
    </item>
    <item>
      <title>Re: Creating polyline from text file</title>
      <link>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56418#M4479</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;for ln in inputFile:&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; pointList = arcpy.Array()
&amp;nbsp;&amp;nbsp;&amp;nbsp; ln = ln.split(",")
&amp;nbsp;&amp;nbsp;&amp;nbsp; name = ln[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp; point = arcpy.Point(ln[1], ln[2])
&amp;nbsp;&amp;nbsp;&amp;nbsp; pointList.add(point)&amp;nbsp; 
polyline = arcpy.Polyline(pointList)&amp;nbsp; &lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:08:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56418#M4479</guid>
      <dc:creator>KennethKirkeby</dc:creator>
      <dc:date>2021-12-10T22:08:49Z</dc:date>
    </item>
    <item>
      <title>Re: Creating polyline from text file</title>
      <link>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56419#M4480</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Kenneth...&lt;/P&gt;&lt;P&gt;nice dedent... &lt;/P&gt;&lt;P&gt;Now work with us...&lt;/P&gt;&lt;P&gt;What did it print out? &lt;/P&gt;&lt;P&gt;I bet you thought it would print out the coordinates...assuming it worked at all? &lt;/P&gt;&lt;P&gt;Did you get an error?&lt;/P&gt;&lt;P&gt;Anything else to add?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Feb 2016 20:46:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56419#M4480</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-02-12T20:46:08Z</dc:date>
    </item>
    <item>
      <title>Re: Creating polyline from text file</title>
      <link>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56420#M4481</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check out the example on the &lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#/Polyline/018z00000008000000/"&gt;Polyline &lt;/A&gt;help page, paying particular attention to fact that multiple lines require multiple lists, or rather, a list of lists.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Feb 2016 20:54:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56420#M4481</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2016-02-12T20:54:05Z</dc:date>
    </item>
    <item>
      <title>Re: Creating polyline from text file</title>
      <link>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56421#M4482</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;forln in inputFile: 
&amp;nbsp;&amp;nbsp;&amp;nbsp; pointList = arcpy.Array()
&amp;nbsp;&amp;nbsp;&amp;nbsp; ln = ln.split(",")
&amp;nbsp;&amp;nbsp;&amp;nbsp; name = ln[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp; point = arcpy.Point(ln[1], ln[2])
&amp;nbsp;&amp;nbsp;&amp;nbsp; pointList.add(point) 
polyline = arcpy.Polyline(pointList)
cursor.insertRow((name, polyline))&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Attribute table:&lt;/P&gt;&lt;P&gt;Shape&amp;nbsp;&amp;nbsp;&amp;nbsp; Name&lt;/P&gt;&lt;P&gt;polyline&amp;nbsp; Line_4&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:08:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56421#M4482</guid>
      <dc:creator>KennethKirkeby</dc:creator>
      <dc:date>2021-12-10T22:08:51Z</dc:date>
    </item>
    <item>
      <title>Re: Creating polyline from text file</title>
      <link>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56422#M4483</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;pointList is getting wiped out for each line in your input file. Within each iteration, you need to add the contents of pointList to an overarching list to persist the coordinates until you are ready to create the lines.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Feb 2016 21:00:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56422#M4483</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2016-02-12T21:00:18Z</dc:date>
    </item>
    <item>
      <title>Re: Creating polyline from text file</title>
      <link>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56423#M4484</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@Aaron - That's what I'm having trouble doing if I understand your point.&amp;nbsp; Create a set of points for Line_1, then Line_2, etc. That's what I do not know how to do.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Feb 2016 21:01:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56423#M4484</guid>
      <dc:creator>KennethKirkeby</dc:creator>
      <dc:date>2016-02-12T21:01:57Z</dc:date>
    </item>
    <item>
      <title>Re: Creating polyline from text file</title>
      <link>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56424#M4485</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This will probably take some digesting:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; import csv
... fc = "myLines"
... with open('C:/junk/points.csv', 'rb') as csvFile:
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; reader = csv.reader(csvFile)
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dict = {}
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in reader:
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dict.setdefault(row[0],arcpy.Array()).add(arcpy.Point(row[1],row[2]))
... print dict
... cursor = arcpy.da.InsertCursor(fc, ["Name","SHAPE@"])
... for k,v in dict.iteritems():
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.insertRow([k,arcpy.Polyline(v)])
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
{'Line_1': &amp;lt;Array [&amp;lt;Point (529018.125025, 4108038.05548, #, #)&amp;gt;, &amp;lt;Point (529005.718792, 4108028.20659, #, #)&amp;gt;, &amp;lt;Point (528993.340503, 4108018.73931, #, #)&amp;gt;, &amp;lt;Point (528980.990158, 4108009.65364, #, #)&amp;gt;, &amp;lt;Point (528968.667757, 4108000.94958, #, #)&amp;gt;]&amp;gt;, 'Line_3': &amp;lt;Array [&amp;lt;Point (528919.657595, 4107969.94943, #, #)&amp;gt;, &amp;lt;Point (528907.474915, 4107963.15341, #, #)&amp;gt;, &amp;lt;Point (528895.320179, 4107956.739, #, #)&amp;gt;, &amp;lt;Point (528883.193387, 4107950.7062, #, #)&amp;gt;]&amp;gt;, 'Line_2': &amp;lt;Array [&amp;lt;Point (528956.373301, 4107992.62713, #, #)&amp;gt;, &amp;lt;Point (528944.106788, 4107984.68629, #, #)&amp;gt;, &amp;lt;Point (528931.86822, 4107977.12705, #, #)&amp;gt;]&amp;gt;, 'Line_4': &amp;lt;Array [&amp;lt;Point (528871.09454, 4107945.055, #, #)&amp;gt;, &amp;lt;Point (528859.023636, 4107939.78542, #, #)&amp;gt;, &amp;lt;Point (528846.980676, 4107934.89744, #, #)&amp;gt;, &amp;lt;Point (528834.965661, 4107930.39107, #, #)&amp;gt;]&amp;gt;}&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I saved your sample data to a csv file. Then, for each row in the csv, add the coordinates (point objects within an array object) to a dictionary, according to the line ID. Once the dictionary is created, for each line ID in the dictionary, insert a feature into the feature class, passing name and shape.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:08:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56424#M4485</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2021-12-10T22:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: Creating polyline from text file</title>
      <link>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56425#M4486</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The print was just a way to know when it ended. I did get it to update my shapefile but with only the last line of the loop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 13 Feb 2016 02:55:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56425#M4486</guid>
      <dc:creator>KennethKirkeby</dc:creator>
      <dc:date>2016-02-13T02:55:23Z</dc:date>
    </item>
    <item>
      <title>Re: Creating polyline from text file</title>
      <link>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56426#M4487</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;logic with indentation (since this is still homework I presume)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;make an empty point list (array)&lt;/P&gt;&lt;P&gt;read the file line by line:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; split the line, and get the point oordinates&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; make the point&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; add the point to the point array&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; read next line&lt;/P&gt;&lt;P&gt;when done, add the points to the polyline&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now if this has to be done for multiple files, then the above logic has to be included indented accordingly.&lt;/P&gt;&lt;P&gt;Darren, offers a solution to reach your end goal, but it uses csv reader to read text files and does essentially the task for file inputs&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 13 Feb 2016 03:09:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56426#M4487</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-02-13T03:09:01Z</dc:date>
    </item>
    <item>
      <title>Re: Creating polyline from text file</title>
      <link>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56427#M4488</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/19932" target="_blank"&gt;Darren Wiens&lt;/A&gt; shows a very clean piece of code to do what you are after. I would definitely go for the solution provided by Darren. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you would have continued along the lines of what you where doing, you would probably end up with something like the code below. Just for you to understand what was missing in your initial code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy

fc = r'D:\Xander\GeoNet\TXT2Polyline\test.gdb\myFeatureClass'
txt_file = r'D:\Xander\GeoNet\TXT2Polyline\myTextFiles.txt'

with arcpy.da.InsertCursor(fc, ["Name","SHAPE@"]) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; with open(txt_file, 'r') as inputFile:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; prev_name = None
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pointList = arcpy.Array()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for line in inputFile:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ln = line.split(",")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name = ln[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; point = arcpy.Point(float(ln[1]), float(ln[2]))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if name != prev_name:
&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; # start of a new line
&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; if pointList.count &amp;gt; 1:
&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; # if previous list has more than 2 points, write line
&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; polyline = arcpy.Polyline(pointList)
&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; cursor.insertRow((prev_name, polyline, ))
&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; # create a new array and add current point
&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; pointList = arcpy.Array()
&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; pointList.add(point)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&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; # same name as previous name, add point to current list
&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; pointList.add(point)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; prev_name = name

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # add last line
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; polyline = arcpy.Polyline(pointList)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.insertRow((name, polyline, ))&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:08:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56427#M4488</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-10T22:08:57Z</dc:date>
    </item>
    <item>
      <title>Re: Creating polyline from text file</title>
      <link>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56428#M4489</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is what I was trying to do for my script. For whatever reason, I could not get the looping straight.Thanks so much for the assistance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Feb 2016 14:47:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56428#M4489</guid>
      <dc:creator>KennethKirkeby</dc:creator>
      <dc:date>2016-02-16T14:47:57Z</dc:date>
    </item>
    <item>
      <title>Re: Creating polyline from text file</title>
      <link>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56429#M4490</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could you mark the answer provided by Darren as the "Correct Answer"? I think it provides the best solution to your question.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Feb 2016 17:08:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56429#M4490</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2016-02-16T17:08:36Z</dc:date>
    </item>
    <item>
      <title>Re: Creating polyline from text file</title>
      <link>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56430#M4491</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/68018"&gt;Kenneth Kirkeby&lt;/A&gt; , I would really like to ask you to mark the post by Darren as the correct answer. Apart from being the first to provide a solution, the solution really shows a cleaner, better and shorter way to solve this problem. By marking his better solution as the correct answer you will enable other users to find his answer more easily.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks, Xander&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Feb 2016 00:11:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56430#M4491</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2016-02-17T00:11:30Z</dc:date>
    </item>
    <item>
      <title>Re: Creating polyline from text file</title>
      <link>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56431#M4492</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Fixed...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Feb 2016 00:14:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-polyline-from-text-file/m-p/56431#M4492</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-02-17T00:14:06Z</dc:date>
    </item>
  </channel>
</rss>

