[GIS] How to split a Polyline Geometry at a certain point in ArcObjects

arcobjectsgeometrysplitting

I have a polyline geometry and wish to split it into two different geometries, based on a given point on that line, in ArcObjects.

I have tried to find out how to do this, but to no avail. I found that there are three methods which are sort of related to what I want.

  1. IFeatureEdit.Split Method This seems to do exactly what I want, but it Works on a Feature, and not on a Geometry. I Do not want to edit existing features, but copy the geometry from an existing feature, split it in two parts, and then process those parts.
  2. IPolycurve.SplitAtPoint Method I though that this method would be useful, but it just adds a new vertex at the point, and does not split the polyline
  3. ITopologicalOperator.Cut Method This would also work, but when I use it, giving a perpendicular line as the input paramter, I am getting an error which says 'An Internal error has occured in the geometry system.'

Is there some way of achieving what I want to do?

Best Answer

I would probably use IPolyCurve.SplitAtPoint and get the paths (parts) created after the split and do your processing on those. As long as the createPart argument is true, SplitAtPoint doesn't just add a new vertex, it inserts a new part between the split point and the end of the path.

Image
(source: arcgis.com)

Whether this is the best approach somewhat depends on what processing you need to do however.

Related Question