I've got some points pair coordinates (start and end points) which I have to transform into lines. Until now, I used an append of both the coordinates in a pippo.Point(), a pippo.CalculateGeometry() to define the geometry of each piont, and pippo.append(defined geometry) to identify the pair of points, and then PointsToLine to obtain my line. Because this is quite time expensive to do for hundreds of lines, I'd really like to know if there's a shorter way to do this, e.g. place starting and ending point of each line in different fields of a single table and import lines directly without passing for points geometry.
|
|
||||
|
|
|
This reads a table (Excel sheet in this case, but could be any table type) that looks like so:
S_X is start X point, E_X end X point, same for Y's. We iterate through the input table, then for each row, set the start/end X/Ys into a point, add that point to an array, then create a polyline from the array of two points. Then insert into the featureclass. Rinse and repeat.
And you get your lines:
|
|||
|
|
I created a python script last week (not using ArcPy though), that takes points that are creating the geometry of bus lines (a point shp) according a sequential number field ("SEQ"). You could easily tweak it to take the coordinate from a field of the same feature (using field value instead of geometry).
Each pair of point will create a single line. There may be a more elegant way to do this, but it created 3900 lines in about 15 seconds so it works for me... |
|||
|
|
you can use these these two tools make XY event layer and Points to line, by seeing the paramaters needed in points to line ( line field , sort points) and update input table data, the task could be simpler |
|||
|
|

