How to find the intersecting area using Arcobjects?

المشرف العام

Administrator
طاقم الإدارة
I created a polygon by buffering a polyline. I need to extract area value (Ex: WaterArea) intersecting the polygon. I tried the code below. It returns all the intersecting water area features. I need the water area values only. My code is :

// Setup a spatial filter for intersecting our buffer area ISpatialFilter sf = new SpatialFilterClass(); sf.GeometryField = fc.ShapeFieldName; sf.Geometry = routeBufferPolygon; sf.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects; // Find the position of the "SQ_MILES" field in the highway feature class. int nameFieldPosition = fc.FindField("SQ_MILES"); // Execute the query and iterate through the cursor's results. var featureCursor = fc.Search(sf, true); IFeature areaFeature = null; int TotalArea = 0; while ((areaFeature = featureCursor.NextFeature()) != null) { int name = Convert.ToInt32(areaFeature.get_Value(nameFieldPosition)); TotalArea += TotalArea; } Sample Image Here : Yellow colour water area!



Expected output:





أكثر...
 
أعلى