ITopologicalOperator intersect returns empty multipoint

417
1
Jump to solution
07-23-2012 09:22 AM
MichaelRutkowski
New Contributor III
I am iterating through a set of features returned from an intersecting spatial query along a line. I want to find out the point(s) along the line that all the features intersect (they definitely do intersect!). However when I call the intersect method on  ITopologicalOperator, I get an empty geometry returned. Any idea how I can get the proper geometry returned?


Public Shared Function GetPointsOfIntersectingFeatureAlongRoute(routeGeometry As IPolyline, intersectingGeometry As IGeometry) As List(Of IPoint)         Dim pnts As List(Of IPoint) = New List(Of IPoint)          Dim newp As IPoint = Nothing         Dim topoOp As ITopologicalOperator = Nothing         Dim geo As IGeometry = Nothing         '  intersectingGeometry.Project(routeGeometry.SpatialReference)         topoOp = intersectingGeometry         geo = topoOp.Intersect(intersectingGeometry, esriGeometryDimension.esriGeometry0Dimension)                 If geo Is Nothing Then Return pnts 'A Geometry is Returned here.... it's just empty         'geo might be a multi point, in which case the geometry intersects a route more than one.         If TypeOf geo Is ESRI.ArcGIS.Geometry.IPointCollection Then             Dim mp As IPointCollection = geo             For i = 0 To mp.PointCount - 1 'does not enter this loop... because the point count = 0                  newp = routeConversionTools.GetPointAlongRouteNearPoint(routeGeometry, mp.Point(i))                 If Not newp Is Nothing Then                     pnts.Add(newp)                 End If             Next i          Else             Dim p As IPoint = geo             newp = routeConversionTools.GetPointAlongRouteNearPoint(routeGeometry, p)             pnts.Add(newp)         End If          Return pnts      End Function 
0 Kudos
1 Solution

Accepted Solutions
DuncanHornby
MVP Notable Contributor
Michael,

I think the problem is here:

topoOp = intersectingGeometry geo = topoOp.Intersect(intersectingGeometry, esriGeometryDimension.esriGeometry0Dimension)


You set topoOP to point to intersectingGeometry then you intersect it with the same geometry intersectingGeometry

Duncan

View solution in original post

0 Kudos
1 Reply
DuncanHornby
MVP Notable Contributor
Michael,

I think the problem is here:

topoOp = intersectingGeometry geo = topoOp.Intersect(intersectingGeometry, esriGeometryDimension.esriGeometry0Dimension)


You set topoOP to point to intersectingGeometry then you intersect it with the same geometry intersectingGeometry

Duncan
0 Kudos