Error when comparing featuress

May 9, 2015 at 2:07 PM
Hi all,
I get the following error message when trying to identify what features in one featureSet that are not represented in another featureSet:

"Merge failed: Cannot compute the quadrant for two identical points Dotspabal,Topology.Coordinate"
var indices = new List<int>();
            foreach (var f1 in sourceFs.Features)
            {
                bool featureFound = false;
                foreach (var f2 in targetFs.Features)
                {
                    if (f1.Contains(f2) && f2.Contains(f1))
                    {
                        featureFound = true;
                        break;
                    }
                }
                if (!featureFound)
                    indices.Add(f1.Fid);
            }
What it the best practice to evaluate if two objects are mutually overlapping? I know you can use different kinds of Linq-expression to compare the Coordinates-lists, but it is slow for large shape files.
Developer
May 19, 2015 at 8:14 AM
It looks like you are trying to check whether two point layers have identical points. Points do know a function called Equals2D which can be used to check whether they are the same.
May 19, 2015 at 10:22 AM
The layers are line layers.
Developer
May 19, 2015 at 10:52 AM
Alright. LineStrings know a function called Equals. That tells you whether the lines geometries are the same. There is also EqualsExact which checks whether both lines have the same points including the same point order.
var ls2 = (LineString)f2.BasicGeometry;
var ls = (LineString)f1.BasicGeometry;
if ls.Equals(ls2) 
{
         featureFound = true;
         break;
}
Although I think it causes more work than the code above using f1.Contains(f2) && f2.Contains(f1) works for me without error. Might be your features are defined incorrectly.