【2010-07-23-01】 ITopologicalOperator 需要知道的三点 (转)
2010-07-23 10:19
344 查看
转自:http://www.fovly.com/article.asp?id=455
// google_ad_client = "pub-6637972513386248";/* 728x90, 创建于 09-6-19 */google_ad_slot = "8252616858";google_ad_width = 728;google_ad_height = 90;
// ]]>
// google_protectAndRun("render_ads.js::google_render_ad", google_handleError, google_render_ad);
// ]]>
When working with the ITopologicalOperator interface, there are 3 things that should be done.
1) QI over to ITopologicalOperator2 and set IsKnownSimple to False, then call Simplify. This should be done for ALL geometries involved.
2) ALL geometries involved should have a spatial reference set. If they don't, then set each geometry's spatial reference to that of the map or something (just set it). If ALL geometries involved do not have the SAME spatial reference, then project ALL geometries into the SAME spatial reference (doesn't matter which you use, just use one of them).
3) Call SnapToSpatialReference on all geometries involved.
After doing this, you will greatly increase your chances of making it through the operation without error. It does not work ALL of the time. ITopologicalOperator is one buggy interface, but doing the 3 things above every time you use it will cut down the number of errors you get significantly. Good luck.
代码
// google_ad_client = "pub-6637972513386248";/* 728x90, 创建于 09-6-19 */google_ad_slot = "8252616858";google_ad_width = 728;google_ad_height = 90;
// ]]>
// google_protectAndRun("render_ads.js::google_render_ad", google_handleError, google_render_ad);
// ]]>
When working with the ITopologicalOperator interface, there are 3 things that should be done.
1) QI over to ITopologicalOperator2 and set IsKnownSimple to False, then call Simplify. This should be done for ALL geometries involved.
2) ALL geometries involved should have a spatial reference set. If they don't, then set each geometry's spatial reference to that of the map or something (just set it). If ALL geometries involved do not have the SAME spatial reference, then project ALL geometries into the SAME spatial reference (doesn't matter which you use, just use one of them).
3) Call SnapToSpatialReference on all geometries involved.
After doing this, you will greatly increase your chances of making it through the operation without error. It does not work ALL of the time. ITopologicalOperator is one buggy interface, but doing the 3 things above every time you use it will cut down the number of errors you get significantly. Good luck.
代码
//Here's some sample VB code that shows one way to do all // of this. Set pTopoOp = pPolygon1 pTopoOp.IsKnownSimple = False pTopoOp.Simplify Set pTopoOp = pPolygon2 pTopoOp.IsKnownSimple = False pTopoOp.Simplify If pPolygon1.SpatialReference Is Nothing Then Set pPolygon1.SpatialReference = pMap.SpatialReference End If If pPolygon2.SpatialReference Is Nothing Then Set pPolygon2.SpatialReference = pMap.SpatialReference End If pPolygon2.Project pPolygon1.SpatialReference pPolygon1.SnapToSpatialReference pPolygon2.SnapToSpatialReference ' now you can FINALLY do the Union. Set pPolygon1 = pTopoOp.Union(pPolygon1) ' hopefully you get to here. MsgBox "Done"
相关文章推荐
- IT创业者需要知道的八个神奇定律
- ITopologicalOperator.Union方法成功地merge polygon
- ITopologicalOperator Buffer调用异常的解决方法(转,ArcEngine)
- IT从业人员需要知道的那点事!
- ITopologicalOperator Buffer调用异常的解决方法 .异常来自 HRESULT:0x8004023E
- ITopologicalOperator接口详解
- 初入IT,你所需要知道的---纯属本人谏言
- 【虫师--系列01】在做性能测试之前需要知道什么
- 优秀项目经理应备技能01-项目管理需要知道的几个概念
- ITopologicalOperator接口详解
- IT高薪你需要知道的理论知识
- IT从业人员需要知道的10个小秘密
- ITopologicalOperator接口使用
- 创建要素类,关系类,ITopologicalOperator接口
- ITopologicalOperator接口使用方法
- 架构师需要知道的97件事-01-06
- ITopologicalOperator Intersect
- IT从业人员需要知道的10个小秘密