All, I have 2 layers as shown below
What I want to do is go through each feature (in pink) and do a spatial filter against the green layer. My current code is
inMemFeatCur = inMemFeatClass.Search(null, true);
inMemFeature = inMemFeatCur.NextFeature();
while (inMemFeature != null)
{
//set the spatial filter
ISpatialFilter spaFil = new SpatialFilterClass();
spaFil.Geometry = inMemFeature.Shape;
spaFil.GeometryField = validationLayer.ShapeFieldName;
spaFil.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
spaFil.SpatialRelDescription = "";
//query the results from the spatial filter
IFeatureCursor geomCursor = inMemFeatClass.Search(spaFil, true);
The problem is the when I go through the geomCursor, it will not find the polygon that is completely outside.
The check i want to do is each polygon (pink) completely within (common boundaries allowed) the green layer. If it is not, a warning will to appear.
I know that IRelationalOperator returns a bool, but i have to go through each green feature which I don't want to do, as I'll be looping many times for each pink feature.
Has anyone got any ideas on how to do this.
No comments:
Post a Comment