<?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 Points to Lines in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/points-to-lines/m-p/220940#M7613</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I tested this script and it produced the lines expected, using a test dbf. When you run it, are you getting multiple copies of the same line? What values are you getting for from this print statement:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;print Searchrow.GetValue("To_Lon"), Searchrow.GetValue("To_Lat")&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 19 Apr 2010 15:46:35 GMT</pubDate>
    <dc:creator>BradPosthumus</dc:creator>
    <dc:date>2010-04-19T15:46:35Z</dc:date>
    <item>
      <title>Points to Lines</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/points-to-lines/m-p/220939#M7612</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi All,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a dbf file with from and to points.&amp;nbsp; I'm trying to use the python examples to generate a polyline&amp;nbsp; but it is defeating me!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The script I have been using is below.&amp;nbsp; Whenever it is run it generates one visible line and creates attribute table entries for the other rows in the input table.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can anybody suggest what is going wrong?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&amp;nbsp; Neil.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Code (the indentation might not be correct on the posting):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import sys, string, os, arcgisscripting&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp = arcgisscripting.create(9.3)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.OverWriteOutput = True&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Out = r"C:\Test_Out.shp"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In = r"C:\In.dbf"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.workspace = os.path.dirname(Out)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.CreateFeatureclass(os.path.dirname(Out), os.path.basename(Out), "POLYLINE")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;cur = gp.InsertCursor (Out)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Searchrows = gp.SearchCursor(In)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Searchrow = Searchrows.Next()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;while Searchrow:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; row = cur.NewRow()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; LineArray = gp.CreateObject("Array")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; pnt = gp.CreateObject ("Point")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; pnt.x = Searchrow.GetValue("From_Lon")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; pnt.y = Searchrow.GetValue("From_Lat")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; LineArray.add(pnt)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; pnt.x = Searchrow.GetValue("To_Lon")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; pnt.y = Searchrow.GetValue("To_Lat")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; LineArray.add(pnt)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; print Searchrow.GetValue("To_Lon"), Searchrow.GetValue("To_Lat")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; row.shape = LineArray&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; cur.InsertRow(row)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Searchrow = Searchrows.Next()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;del row, cur&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Apr 2010 08:22:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/points-to-lines/m-p/220939#M7612</guid>
      <dc:creator>neilwebster</dc:creator>
      <dc:date>2010-04-19T08:22:16Z</dc:date>
    </item>
    <item>
      <title>Points to Lines</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/points-to-lines/m-p/220940#M7613</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I tested this script and it produced the lines expected, using a test dbf. When you run it, are you getting multiple copies of the same line? What values are you getting for from this print statement:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;print Searchrow.GetValue("To_Lon"), Searchrow.GetValue("To_Lat")&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Apr 2010 15:46:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/points-to-lines/m-p/220940#M7613</guid>
      <dc:creator>BradPosthumus</dc:creator>
      <dc:date>2010-04-19T15:46:35Z</dc:date>
    </item>
    <item>
      <title>Points to Lines</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/points-to-lines/m-p/220941#M7614</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the reply.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The line mentioned outputs the cordinates of the to nodes, as per the input file.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However no line is created.&amp;nbsp; The only line created is for the first line of the input file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Apr 2010 06:36:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/points-to-lines/m-p/220941#M7614</guid>
      <dc:creator>neilwebster</dc:creator>
      <dc:date>2010-04-20T06:36:25Z</dc:date>
    </item>
    <item>
      <title>Points to Lines</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/points-to-lines/m-p/220942#M7615</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I just tried your code myself on a test dbf and got the right output. I would take a look at your test file. Maybe the points are identical?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Apr 2010 16:37:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/points-to-lines/m-p/220942#M7615</guid>
      <dc:creator>JonathanBaarda</dc:creator>
      <dc:date>2010-04-20T16:37:06Z</dc:date>
    </item>
    <item>
      <title>Points to Lines</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/points-to-lines/m-p/220943#M7616</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Dont you allso need to give the points an id?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;changing:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;pnt.x = Searchrow.GetValue("From_Lon")
pnt.y = Searchrow.GetValue("From_Lat")
LineArray.add(pnt)

pnt.x = Searchrow.GetValue("To_Lon")
pnt.y = Searchrow.GetValue("To_Lat")
LineArray.add(pnt)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;to:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
pnt.id = some_counter
pnt.x = Searchrow.GetValue("From_Lon")
pnt.y = Searchrow.GetValue("From_Lat")
LineArray.add(pnt)

pnt.id = some_counter
pnt.x = Searchrow.GetValue("To_Lon")
pnt.y = Searchrow.GetValue("To_Lat")
LineArray.add(pnt)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:46:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/points-to-lines/m-p/220943#M7616</guid>
      <dc:creator>Jan_ToreKyrdalen</dc:creator>
      <dc:date>2021-12-11T10:46:18Z</dc:date>
    </item>
  </channel>
</rss>

