Switch spatial selection

Discussion created by kyanuk1 on Oct 25, 2012
Latest reply on Oct 31, 2012 by kenbuja

I have a stand alone application where I want to perform a spatial query - however, I want to find the features that do not intersect the polygon I am querying against.

What I had done is used a SpatialFilter to find the features that do intersect, and perform a NOT IN query:

while (buffFeat != null)
                buffGeom = buffFeat.ShapeCopy;
                bufftOp = (ITopologicalOperator)buffGeom;
                ISpatialFilter sf = new SpatialFilterClass();
                sf.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
                sf.Geometry = buffGeom;
                IFeatureCursor pedCurs = selectFC.Search(sf, false);
                IFeature pedFeat = pedCurs.NextFeature();
                while (pedFeat != null)
                    pedFeat = pedCurs.NextFeature();
                buffFeat = buffFeatCurs.NextFeature();

Then, in another method where I am performing the selection:

List<string> intersectedPedOIDS = GetBufferedPedSignals(pedSignalFC, buffFC);
string query = "OBJECTID NOT IN(" + String.Join(",", intersectedPedOIDS.ToArray()) + ")";

Which in theory works, however, I get this oracle error:

Underlying DBMS error [ORA-01795: maximum number of expressions in a list is 1000]

Is there a better way of doing this?