Friday 25 December 2015

arcobjects - Spatial relationships that do not match


All, I have 2 layers as shown below enter image description here


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

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...