# Displaying Lines with Lat/Long Coordinates to ArcMap

614
1
04-22-2017 04:23 PM
New Contributor

Recently downloaded a spreadsheet that contains street data for a city that I'm doing an analysis for. The goal is to export this table in ArcMap, where I will use the geometry column to convert the lat/long coordinates into lines. When the data is exported into ArcMap, all the cells are not successfully exported, except for the first three rows. My guess is that the 4th row surpasses the 255 character limit and then consequently interrupts the rest of the data from transferring over. Is there a way to solve this?

On another note, how do I display the first three rows that do show up as lines on the map? I did check out some tools that could display XY data as points (which isn't what I want to do) and XY data as lines (which seemingly limits a line to two sets of lat/long pairs). In the case for the first row, how do you create a line that has three sets of coordinate sets?

Tags (4)
Esri Esteemed Contributor

First of all, it would be better to just use the data as text file to read it into ArcGIS. Arcpy has a method that allows you to convert the WKT string that you have directly into a geometry (polyline):

If I use this snippet of code:

``import arcpyline = 'LINESTRING(1981440.31013335 10450262.42901984, 1981440.31013335 10450262.42901984, 1981443.31013335 10450265.42901984)'polyline = arcpy.FromWKT(line)print type(polyline)print polyline.length‍‍‍‍‍``

... it will return this:

``<class 'arcpy.arcobjects.geometries.Polyline'>4.24264068712‍‍``

If you look at this thread: Utilizing 'fromWKT' function in python in version 10.1  and scroll down almost to the end of the thread you will see that Kim Ollivier  mentions that you can use the arcpy.da.InsertCursor and use the string directly to create the geometry.

If you need some help, please share (part of) you data and I'll have a look. I also noticed that you have zip_code info in the same file and perhaps more attributes, and it might be interesting to have these too in the resulting featureclass.