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. This is quite time expensive to do for hundreds of lines.
Is there a shorter way to do this?
For example, place starting and ending point of each line in different fields of a single table and import lines directly without passing for points geometry.
Best Answer
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: