performance: validating topology vs. spatial filter

Discussion created by kekeje on May 25, 2011
Latest reply on May 26, 2011 by kekeje
ArcView license doesn't support topology validation so I had to implement my own. I used spatial filters and topological operators.

It turned out my implementation is so much slower than validating topology in ArcEditor/ArcInfo. Anybody has any idea how ESRI implements its topology validation so fast? Any idea will be much appreciated!!

Below is some code segment that shows what I did, for a polyline layer (rules checked: no multipart; no self-intersect; no self-overlap; no overlap):

IFeatureCursor feat_cursor = streetsegs.Search(null, false);
IFeature feat = null;
while ((feat = feat_cursor.NextFeature()) != null)

//check for multipart
IGeometryCollection geoColl = feat.Shape as IGeometryCollection;
if (geoColl.GeometryCount > 1)
polylines_Multipart.Add(feat.Shape as Polyline);

//check for self-overlap and self-intersect
ITopologicalOperator2 topoOp = (feat.Shape as IPolyline) as ITopologicalOperator2;
topoOp.IsKnownSimple_2 = false;
if (topoOp.IsSimple == false)
Debug.WriteLine(feat.OID + " is NOT simple");
polylines_SelfIntersect.Add(feat.Shape as Polyline);

//check for overlapping
ISpatialFilter spatialFilter = new SpatialFilterClass();
spatialFilter.Geometry = feat.Shape;
spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelOverlaps;

IFeatureCursor feat_cursor1 = streetsegs.Search(spatialFilter, false);
IFeature feat1 = null;
while ((feat1 = feat_cursor1.NextFeature())!= null)
polylines_Overlap.Add(feat.Shape as Polyline);


How may I improve the performance? For some idea, this runs about 6min for a layer with 25000 features, but topology validation in ArcEditor only takes seconds. Thank you in advance!