Private Function GetArea(FeatureA As IFeature, FeatureB As IFeature) As Double Dim SourceArea As IArea Dim TargetArea As IArea Dim TopoOp As ITopologicalOperator3 Dim IntersectArea As IArea Set SourceArea = FeatureA.Shape 'FeatureA and FeatureB are the polygons to be checked for overlap Set TargetArea = FeatureB.Shape Set TopoOp = TargetArea Set IntersectArea = TopoOp.Intersect(pSourceArea, esriGeometry2Dimension) GetArea = (IntersectArea.Area / SourceArea.Area) * 100 'returns the percentage of first polygon which overlaps second polygon Set SourceArea = Nothing Set TargetArea = Nothing Set TopoOp = Nothing Set IntersectArea = Nothing
Private Function GetArea(FeatureA As IFeature, FeatureB As IFeature) As Double Dim SourceArea As IArea Dim TargetArea As IArea Dim TopoOp As ITopologicalOperator3 Dim IntersectArea As IArea Set SourceArea = FeatureA.Shape 'FeatureA and FeatureB are the polygons to be checked for overlap Set TargetArea = FeatureB.Shape Set TopoOp = TargetArea Set IntersectArea = TopoOp.Intersect(pSourceArea, esriGeometry2Dimension) GetArea = (IntersectArea.Area / SourceArea.Area) * 100 'returns the percentage of first polygon which overlaps second polygon Set SourceArea = Nothing Set TargetArea = Nothing Set TopoOp = Nothing Set IntersectArea = Nothing End Function
Lets say your data layer has over a 1000 polygons and you would like to know for each polygon the percentage of that polygon that is overlapped, is there a way to do this? Maybe something that adds a field into your layer with that information?