{
// Must be called within QueuedTask.Run
void FindSpatiallyRelatedFeaturesUsingDE9IMPredicate(Geodatabase geodatabase, FeatureClass polygonFeatureClass, FeatureClass polylineFeatureClass)
{
using (RowCursor polygonRowCursor = polygonFeatureClass.Search(new QueryFilter()))
{
if (polygonRowCursor.MoveNext())
{
using (Feature polygonFeature = polygonRowCursor.Current as Feature)
{
// DE9IM predicate string to find overlapping features
string overlappingDE9IM = "1*T***T**";
SpatialQueryFilter spatialQueryFilter = new SpatialQueryFilter()
{
FilterGeometry = polygonFeature.GetShape(),
SpatialRelationship = SpatialRelationship.Relation,
SpatialRelationshipDescription = overlappingDE9IM
};
using (RowCursor overlappingPolyline = polylineFeatureClass.Search(spatialQueryFilter))
{
while (overlappingPolyline.MoveNext())
{
// Overlapping polylines on the polygon
}
}
}
}
}
}
}
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)