I have two feature layers. The first one is just a polygon and the other one consists of a series of polygons which are enclosed by the first one. Thus, some polygons of the second feature layer touch on the boundaries of the first feauture layer. I wrotre a code (the basic part shown below to identify which polygons of the second layer touches the boundary of the polygon in the first layer but while the code runs without a problem it does not identify (e.g. by giving FID with Msgbox) any such polygon whilsty it should.
Any help please?
Dim pBlockBoundaryFC As IFeatureClass
Set pBlockBoundaryFC = pBlockBoundary.FeatureClass
Dim pBlockBoundaryFields As IFields
Set pBlockBoundaryFields = pBlockBoundaryFC.Fields
Dim pGeom As IGeometry
Dim pSpatialFilter As ISpatialFilter
Set pSpatialFilter = New SpatialFilter
Dim pBlockBoundaryCursor As IFeatureCursor
Set pBlockBoundaryCursor = pBlockBoundaryFC.Search(pSpatialFilter, False)
Set pBlockBoundaryFeature = pBlockBoundaryCursor.NextFeature
Do Until pBlockBoundaryFeature Is Nothing
Set pGeom = pBlockBoundaryFeature.Shape
With pSpatialFilter
Set .Geometry = pGeom
.GeometryField = "Shape"
.SpatialRel = esriSpatialRelTouches
End With
Dim pRelOp As IRelationalOperator
Set pRelOp = pGeom
Set pNewParcelsFeature = pNewParcelsCursor.NextFeature
Do Until pNewParcelsFeature Is Nothing
FID = pNewParcelsFeature.Value(intposFID)
If pRelOp.Touches(pNewParcelsFeature.Shape) Then
''Report the FID of each parcel that 'touches' the exetrnal boundary
MsgBox FID
End If
Set pNewParcelsFeature = pNewParcelsCursor.NextFeature
Loop
Set pBlockBoundaryFeature = pBlockBoundaryCursor.NextFeature
Loop