Problem with Intersect!...

517
1
04-02-2012 07:24 AM
KevinOrcutt
New Contributor
Howdy All,
I'm running into a problem with the ITopologicalOperator.Intersect function. I am working with two features from the same geodatabase that are polylines. I am trying to find the point at which the two line intersect. I happen to know that the intersect by visually inspecting the corner. I'm sure there's some test that I should do before trying the Intersect function. I am getting a "COMException was unhandled by user code" error on the line I call the Intersect function. Here is the code, including the calling line to my function:

'Calling line here...
PointResult = GetIntersectionPoint(CenterlineToSplitFeature.ShapeCopy, IntersectingFeature.ShapeCopy)


'Function code here...
Function GetIntersectionPoint(Line1 As IGeometry, Line2 As IGeometry) As IPoint

        Dim pGeom As IGeometry
        Dim pTopo As ITopologicalOperator

        pTopo = Line1

        'Here's the line in which I get the error...
        pGeom = pTopo.Intersect(Line2, esriGeometryDimension.esriGeometryNoDimension)

        Dim ppoints As IPointCollection
        Dim ppoint As IPoint

        ppoints = pGeom

        If ppoints.PointCount > 0 Then
            ppoint = ppoints.Point(0)
            Return ppoint
        Else
            Return Nothing
        End If

    End Function


The particular ErrorCode I get is: -2147220971

Any clues as to what I'm doing wrong, or better yet as to how I might fix this...

More particulars:
VB .Net - Visual Studio 2010
ArcMap 10.x, sp 4
Windows 7 - 32-bit

Here's a snapshot of the actual intesection: The lines dDO intersect, but not at any vertice on either line. Also both line do have "arc"/curve sections in themselves, if that has anything to do with it...
[ATTACH=CONFIG]13182[/ATTACH]


Thanks in advance,


Kevin Orcutt
GIS Developer/Consultant
City of Cincinnati - Cincinnati Area GIS (CAGIS)
(513) 850-1335 (cell)
Kevin.Orcutt@cincinnati-oh.gov
www.cagis.org
0 Kudos
1 Reply