Select to view content in your preferred language

Dissolving lines with opposing direcionality

5280
11
03-23-2012 10:51 AM
TomSomers
Emerging Contributor
When you dissolve arcs using the dissolve tool, does directionality of the arcs come into play. In other words, if two adjacent arcs are not going in the same direction will they not be dissolved.
0 Kudos
11 Replies
DanLee
by Esri Regular Contributor
Esri Regular Contributor
Thanks for the good question. I think the tool could provide an option for additional analysis to preserve existing line direction as long as a set of connected lines are all in the same direction. I will propose the enhancement for a future release. If you like, please submit an enhancement request through Esri Support as well.
0 Kudos
geodanadmin
Deactivated User
Fix by rebuilding geometry in arcobjects & perform ITopologicalOperator.Simplify. (TODO: set MAware, ZAware, M's and/or Z's)

        private IFeatureClass FixArcGisDoubleLinesBug(IFeatureClass unsplitFeatureClass)
        {
            IFeatureCursor updateFeatureCursor = unsplitFeatureClass.Update(null, false);
            try
            {
                for (IFeature feature = updateFeatureCursor.NextFeature(); feature != null; feature = updateFeatureCursor.NextFeature())
                {
                    IGeometry srcGeometry = feature.ShapeCopy;
                    var srcPointCollection = srcGeometry as IPointCollection;

                    IPath targetPath = new PathClass();
                    var targetPointCollection = targetPath as IPointCollection;
                    object missing = Type.Missing;

                    for (int i = 0; i < srcPointCollection.PointCount; i++)
                    {
                        IPoint aPoint = new PointClass();
                        aPoint.X = srcPointCollection.Point.X;
                        aPoint.Y = srcPointCollection.Point.Y;
                        targetPointCollection.AddPoint(aPoint, ref missing, ref missing);
                    }

                    IPolyline targetPolyline = new PolylineClass();
                    var targetPolylineGeometries = targetPolyline as IGeometryCollection;
                    targetPolylineGeometries.AddGeometry(targetPath as IGeometry, ref missing, ref missing);

                    ITopologicalOperator topologicalOperator = targetPolyline as ITopologicalOperator;
                    topologicalOperator.Simplify();

                    feature.Shape = targetPolyline;

                    updateFeatureCursor.UpdateFeature(feature);

                }
            }
            finally
            {
                if (updateFeatureCursor != null)
                    Marshal.FinalReleaseComObject(updateFeatureCursor);
            }
0 Kudos