<?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: Can I import csv file of line data? in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/can-i-import-csv-file-of-line-data/m-p/1245939#M64041</link>
    <description>&lt;P&gt;Thank you! I didn't tried this yet, but this seems very fit for my purpose.&lt;/P&gt;</description>
    <pubDate>Fri, 06 Jan 2023 07:46:40 GMT</pubDate>
    <dc:creator>asdfjljwg</dc:creator>
    <dc:date>2023-01-06T07:46:40Z</dc:date>
    <item>
      <title>Can I import csv file of line data?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/can-i-import-csv-file-of-line-data/m-p/1245509#M63977</link>
      <description>&lt;P&gt;Hello, I have a csv-structured dataset as follows :&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="20%" height="25px"&gt;ID&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;x1&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;y1&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;x2&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;y2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%" height="25px"&gt;1&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;14184878&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;4442592&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;14184886&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;4442595&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%" height="25px"&gt;2&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;14184504&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;4443068&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;14184511&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;4443076&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%" height="25px"&gt;...&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;...&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;...&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;...&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;...&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a line dataset, whose x values are latitude and y values are longitude of two points of each line.&lt;/P&gt;&lt;P&gt;But I have no idea how to import this in line form, because the only way importing csv file into GIS I've known so far is just dropping it and clicking 'XY data display' menu. And if I do this, I can use coordinates of only one point. Thus, I can only import this csv file in only point form.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So is there any way that I can import this in line form?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2023 02:05:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/can-i-import-csv-file-of-line-data/m-p/1245509#M63977</guid>
      <dc:creator>asdfjljwg</dc:creator>
      <dc:date>2023-01-05T02:05:43Z</dc:date>
    </item>
    <item>
      <title>Re: Can I import csv file of line data?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/can-i-import-csv-file-of-line-data/m-p/1245528#M63981</link>
      <description>&lt;P&gt;I think you will need python to do this - someone posted a solution here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://gis.stackexchange.com/questions/34647/creating-lines-from-points-pair-coordinates-with-arcpy" target="_blank" rel="noopener"&gt;https://gis.stackexchange.com/questions/34647/creating-lines-from-points-pair-coordinates-with-arcpy&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I tried the code of Chad Cooper there with four points with the old cursors ... it seems to work.&lt;/P&gt;&lt;P&gt;Here is the code I used:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

fieldnames = ['X1', 'Y1', 'X2', 'Y2']
# Needed input/ output files
inExcel = r"YOURPATH\Points.xlsx"
FGDB = r"YOURPATH\Points2Lines.gdb"
outTable = "Coords"
outLines = "Lines"

arcpy.env.workspace = FGDB
arcpy.env.overwriteOutput = True

# Change to your Sheet name!
arcpy.conversion.ExcelToTable(inExcel, outTable, "Test")

in_rows = arcpy.SearchCursor(outTable)

point = arcpy.Point()
array = arcpy.Array()

# Without Spatial Reference, please change!
arcpy.CreateFeatureclass_management(FGDB, outLines, "POLYLINE")

featureList = []
cursor = arcpy.InsertCursor(outLines)
feat = cursor.newRow()

for in_row in in_rows:
    # Set X and Y for start and end points
    # Change here to your field names
    point.X = in_row.X1
    point.Y = in_row.Y1
    array.add(point)
    point.X = in_row.X2
    point.Y = in_row.Y2
    array.add(point)   
    # Create a Polyline object based on the array of points
    polyline = arcpy.Polyline(array)
    # Clear the array for future use
    array.removeAll()
    # Append to the list of Polyline objects
    featureList.append(polyline)
    # Insert the feature
    feat.shape = polyline
    cursor.insertRow(feat)
del feat
del cursor&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2023 11:51:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/can-i-import-csv-file-of-line-data/m-p/1245528#M63981</guid>
      <dc:creator>JohannesBierer</dc:creator>
      <dc:date>2023-01-05T11:51:25Z</dc:date>
    </item>
    <item>
      <title>Re: Can I import csv file of line data?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/can-i-import-csv-file-of-line-data/m-p/1245939#M64041</link>
      <description>&lt;P&gt;Thank you! I didn't tried this yet, but this seems very fit for my purpose.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jan 2023 07:46:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/can-i-import-csv-file-of-line-data/m-p/1245939#M64041</guid>
      <dc:creator>asdfjljwg</dc:creator>
      <dc:date>2023-01-06T07:46:40Z</dc:date>
    </item>
    <item>
      <title>Re: Can I import csv file of line data?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/can-i-import-csv-file-of-line-data/m-p/1245965#M64044</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You can easily use xy to line geoprocessing tool and you will be able to add this CSV file in line form&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Ahmed fathy&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jan 2023 12:38:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/can-i-import-csv-file-of-line-data/m-p/1245965#M64044</guid>
      <dc:creator>AhmedFathy74</dc:creator>
      <dc:date>2023-01-06T12:38:23Z</dc:date>
    </item>
  </channel>
</rss>

