Select to view content in your preferred language

Problems with ITopologicalOperator Cut

1280
1
01-30-2013 12:40 PM
JeremySury
Emerging Contributor
I'm thoroughly baffled!  I'm using ITopologicalOperator.Cut to cut polyline road segments that cross polyline boundaries.

            While Not pFeature Is Nothing

                pCuttingPolygonBoundary = ConvertPolygonToPolyline(pFeature.Shape)

                If pCuttingPolygonBoundary.SpatialReference Is Nothing Then
                    pCuttingPolygonBoundary.SpatialReference = pPublicMap.SpatialReference
                End If

                pCuttingPolygonBoundary.SnapToSpatialReference()
                pTopoOp = pCuttingPolygonBoundary
                pTopoOp.IsKnownSimple_2 = False
                pTopoOp.Simplify()

                pSF = New SpatialFilter
                pSF.Geometry = pCuttingPolygonBoundary
                pSF.GeometryField = m_OutputFeatureClass.ShapeFieldName
                pSF.SpatialRel = esriSpatialRelEnum.esriSpatialRelCrosses

                pPolylineFeatureCursor = m_OutputFeatureClass.Search(pSF, False)
                pPolylineFeature = pPolylineFeatureCursor.NextFeature()
                sOIDList = ""

                While Not pPolylineFeature Is Nothing

                    pLeftPolyline = New Polyline
                    pRightPolyline = New Polyline

                    pPolyline = pPolylineFeature.ShapeCopy

                    If pPolyline.SpatialReference Is Nothing Then
                        pPolyline.SpatialReference = pPublicMap.SpatialReference
                    End If

                    pPolyline.Project(pCuttingPolygonBoundary.SpatialReference)
                    pPolyline.SnapToSpatialReference()

                    pTopoOp = pPolyline
                    pTopoOp.IsKnownSimple_2 = False
                    pTopoOp.Simplify()

                    pTopoOp.Cut(pCuttingPolygonBoundary, pLeftPolyline, pRightPolyline)



I then put the resulting left and right polylines into the featureclass and delete the original polyline.  It seems to work however when I do a spatial selection using the crossed by the outline selection method some of the polylines are still selected.  Its my understanding that the split lines no longer cross the boundary put simply touch it.

Is there something I'm missing?
0 Kudos
1 Reply
WeifengHe
Esri Contributor
Is the spatial reference for the polyline feature class the same as the public map?  Because when you saved the output to the feature class, it get snapped to the spatial reference of the feature class.

One thing you can check is that after cutting, run the selection on the out put polylines before saving to the feature class and see whether or not the results ok.
0 Kudos