关于“异常来自 HRESULT:0x80040218”

时间:2021-07-14 18:59:19

问题:进行拓扑运算(ITopologicalOperator.SymmetricDifference)的时候报错“异常来自 HRESULT:0x80040218”

解决方案:经网上查阅资料,发现是输入图形未经简化处理所致。对于进行拓扑运算的图形,都要进行Simplify处理。完善代码如下:

1                         ITopologicalOperator topoOpr = bigPolygon as ITopologicalOperator;
2                         topoOpr.Simplify();
3                         (smallPolygon as ITopologicalOperator).Simplify();
4                         IPolygon ringpoly = topoOpr.SymmetricDifference(smallPolygon as IGeometry) as IPolygon;

参考:http://gis-conquer.blog.sohu.com/244181846.html