Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

We are currently working on a project where we have to merge sections (polylines) to a route, but the big question is how you do this. We have currently tried adding those two as segmentcollections but it gives some rather wicked results.

share|improve this question
add comment

2 Answers 2

up vote 7 down vote accepted

Try using the ITopologicalOperator.Union method called on one of those polylines, passing the second one as its parameter. As long as the two polylines' endpoints meet, this approach should solve your problem.

EDIT: when performing union on multiple geometries (more than two), ITopologicalOperator.ConstructUnion is more efficient. You would call this method on an empty (freshly created) Polyline, passing an enumeration of all the polylines. This enumeration can be a GeometryBag instance as it implements IEnumGeometry.

share|improve this answer
    
I just switched back from ITopologicalOperator.ConstructUnion to ITopologicalOperator.Union because the merged geometry wasn't correct --vertices were moved (looked almost like the line was generalized except the vertex count didn't change). –  Jay Cummins Jun 22 '11 at 16:51
add comment

can we also use MergeGeometries from IConstructMerge Interface i guess even that can solve the above said issue !

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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