欢迎您来到GIS动力

加入收藏 免费注册 用户登陆 帮助中心
首页 新闻动态 技术专栏 银杏树下 学习考研 软件下载 求职招聘 许愿瓶 节日祝福 用户中心 精彩推荐 资源搜索 地图
专栏导航: AO开发 | SO开发 | ArcGIS桌面 | 超图桌面 | 开发语言 | 数据库 | WebGIS | 银杏文学 | 研究生考题 | FreeMap FreeTalk
   您现在位于: 首页技术专栏ArcGIS应用与开发AO开发 → 正文
ITopologicalOperator.union问题
08-09-01 09:56:01 作者:半块点心 出处:『GIS动力』原创
用ITopologicalOperator.union进行多边形合并时,需要注意
从www.esri.com里面找到的资料,贴出来:
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"
(本文已被浏览 次)
发布人:admin
推荐给好友:发送给好友
上篇新闻:
下篇新闻:
相关评论
发表我的评论
  • 尊重网上道德,遵守《全国人大常委会关于维护互联网安全的决定》及中华人民共和国其他各项有关法律法;
  • 本站有权保留或删除您发表的任何评论内容;
  •   相关文章  
    无相关新闻

    关于我们友情链接 ┋ 与我在线 ┋ 管理 ┋ TOP
     
    网站当前版本:GisPower CMS V3.0
    『GIS 动力』- http://www.gispower.org/
    联系我们:webmaster#gispower.org
    Copyright (c) 2003-2007 GisPOwer.Org. All Rights Reserved.
     

                   滇ICP备05006901号