<?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: Write polyline vertices to csv in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/write-polyline-vertices-to-csv/m-p/569952#M44691</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Tony,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You could perform the following steps:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1.&amp;nbsp; Convert the lines vertices to a point feature class using &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//00170000003p000000"&gt;Feature Vertices to Points&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;2.&amp;nbsp; &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//001700000032000000"&gt;Add XY Coordinates&lt;/A&gt;&lt;SPAN&gt; to point feature class&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3.&amp;nbsp; &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//001200000027000000"&gt;Export&lt;/A&gt;&lt;SPAN&gt; feature class to dbf file&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4.&amp;nbsp; Rename output dbf file to csv using &lt;/SPAN&gt;&lt;A href="http://www.tutorialspoint.com/python/os_rename.htm"&gt;os.rename&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 Apr 2014 14:53:49 GMT</pubDate>
    <dc:creator>JakeSkinner</dc:creator>
    <dc:date>2014-04-10T14:53:49Z</dc:date>
    <item>
      <title>Write polyline vertices to csv</title>
      <link>https://community.esri.com/t5/python-questions/write-polyline-vertices-to-csv/m-p/569951#M44690</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am looking for some code to write out each line feature in a feature class/shapefile to a csv file that would look something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;FID, X, Y&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;All help is appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tony&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Apr 2014 13:27:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/write-polyline-vertices-to-csv/m-p/569951#M44690</guid>
      <dc:creator>TonyAppel1</dc:creator>
      <dc:date>2014-04-10T13:27:54Z</dc:date>
    </item>
    <item>
      <title>Re: Write polyline vertices to csv</title>
      <link>https://community.esri.com/t5/python-questions/write-polyline-vertices-to-csv/m-p/569952#M44691</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Tony,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You could perform the following steps:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1.&amp;nbsp; Convert the lines vertices to a point feature class using &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//00170000003p000000"&gt;Feature Vertices to Points&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;2.&amp;nbsp; &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//001700000032000000"&gt;Add XY Coordinates&lt;/A&gt;&lt;SPAN&gt; to point feature class&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3.&amp;nbsp; &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//001200000027000000"&gt;Export&lt;/A&gt;&lt;SPAN&gt; feature class to dbf file&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4.&amp;nbsp; Rename output dbf file to csv using &lt;/SPAN&gt;&lt;A href="http://www.tutorialspoint.com/python/os_rename.htm"&gt;os.rename&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Apr 2014 14:53:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/write-polyline-vertices-to-csv/m-p/569952#M44691</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2014-04-10T14:53:49Z</dc:date>
    </item>
    <item>
      <title>Re: Write polyline vertices to csv</title>
      <link>https://community.esri.com/t5/python-questions/write-polyline-vertices-to-csv/m-p/569953#M44692</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You could also use the &lt;/SPAN&gt;&lt;A href="https://docs.python.org/2/library/csv.html"&gt;python csv module &lt;/A&gt;&lt;SPAN&gt;to write the file out.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Apr 2014 15:14:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/write-polyline-vertices-to-csv/m-p/569953#M44692</guid>
      <dc:creator>Zeke</dc:creator>
      <dc:date>2014-04-10T15:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: Write polyline vertices to csv</title>
      <link>https://community.esri.com/t5/python-questions/write-polyline-vertices-to-csv/m-p/569954#M44693</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;A search cursor like this could easily iterate through all the points and add them to a csv file for you.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The key here is to use the "explode to points" method in the search cursor&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import csv
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
with arcpy.da.SearchCursor(featureClass, ["OID@","SHAPE@XY"],explode_to_points=True) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; with open("outputFile.csv","wb") as csvfile:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; writer = csv.writer(csvfile)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.writerow(["FID","LAT","LON"])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FID = row[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lat = row[1][1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lon = row[1][0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.writerow([FID,lat,lon])&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Matt&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:32:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/write-polyline-vertices-to-csv/m-p/569954#M44693</guid>
      <dc:creator>MattEiben</dc:creator>
      <dc:date>2021-12-12T00:32:30Z</dc:date>
    </item>
    <item>
      <title>Re: Write polyline vertices to csv</title>
      <link>https://community.esri.com/t5/python-questions/write-polyline-vertices-to-csv/m-p/569955#M44694</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am not sure, but will the 'Export Feature Attribute to ASCII' tool do the trick?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I found it under Spatial Statistics -&amp;gt; Utilities ....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Matthew&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Apr 2014 03:30:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/write-polyline-vertices-to-csv/m-p/569955#M44694</guid>
      <dc:creator>MatthewDobson</dc:creator>
      <dc:date>2014-04-11T03:30:28Z</dc:date>
    </item>
  </channel>
</rss>

