Let me describe the data setup. A line has been provided as an array of coordinate pairs, one for each vertex. This array is variable in size, anywhere from 2 to 200 coordinate pairs per line. What I am trying to wrap my mind around is the best way to create these lines. Arcpy and ArcObjects are both viable options, but ArcObjects is preferred due to its speed (generally).

I have brainstormed a few methods, but they fall short for some reason or another:

1) I could use the Polyline class with arcpy to create polylines and then Copy Features, but the resulting geometry would not have any of the attribution necessary to identify said points.

2) I could use XY To Line, but this only works with one pair of point, and I require something much more robust.

The long and short is that I require a method that can create a polyline from arrays and maintain a schema for data that I have created in a table. One idea I have is to create said table and schema, and then somehow create the polyline and copy its shape property to the output table, porting over the ID and whatever other attribution is needed. How can I go about creating the polyline's shape property without resorting to an intermediate shapefile? Or, if there is a better method that comes to mind, please share it with me.

Update This code seems to work!

IFeatureClass fClass = gpUtil.OpenFeatureClassFromString(path);
IFeatureCursor cursor = fClass.Insert(true);
IFeatureBuffer buffer = fClass.CreateFeatureBuffer();


string[] nodearray = a.Split(';');
foreach (string i in nodearray)
    query.WhereClause = "\"PNT_ID\" = '" + i+"'";
    ICursor search = table.Search(query, false);
    IRow row = search.NextRow();
    float x = float.Parse(row.get_Value(2).ToString());
    float y = float.Parse(row.get_Value(3).ToString());
    int id = int.Parse(row.get_Value(1).ToString());
    point.X = x;
    point.Y = y;
    point.ID = id;
    point.SpatialReference = sRef;
    pCollection.AddPoint(point, ref Missing, ref Missing);

IGeometry5 polygeo = (IGeometry5)pCollection;
buffer.set_Value(1, polygeo);
buffer.set_Value(2, wayid);

2 Answers 2


It looks like I've got it. I created an IPoint class and used it to fill an IPointCollection instantiated as a PolylineClass. Then I cast the collection to IGeometry5 and used that as the shape field for the row in my output feature class, copying over the ID with a buffer.

I got my head twisted in a few circles working with two inputs, but it seems to work all right.


I'm struggling with a similar schema here.

I have to identify lines and their vertexes and maintain a Line has Vertex relationship between them. I think I'm dealing with a larger requirement (I'm nor sure), but we are implementing this as views and feature class extensions (largely to maintain our "segment" tables)

basic schema is

Line Table Name (PK)

Point Table Name (PK)

LineSegmentTable LineName (FK) ID Order FromPoint (FK) ToPoint (FK)

LineView Name Geometry

In your case, a "vertex" table might be more suitable. We are running on Oracle, also.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.