The Geometry has no Z values 解决办法(转载)
生活随笔
收集整理的這篇文章主要介紹了
The Geometry has no Z values 解决办法(转载)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
from:http://dufan20086.blog.163.com/blog/static/6616452320145269343675/
?
?
我們在創建要素時,簡單的IFeatureClass.CreateFeature之后,然后把IGeometry對象賦給Feature.shape,會引發“The Geometry has no Z values”的錯誤提示。類似的錯誤在做地圖標注過程中也會出現。?
本文所采用的解決辦法參考了網上的一些資料: http://blog.sina.com.cn/s/blog_6faf711d010138vq.html http://hi.baidu.com/luoyuonline/item/2994bafc08e10f0dd99e7256 基本思路就是在CreateFeature之后,設置Z值(順帶將M值也一并設置)。 /// <summary> /// 設置Z值和M值,解決The Geometry has no Z values錯誤 /// </summary> /// <param name="pF">要素</param> /// <param name="pGeo">幾何</param> public static void SetZValue(IFeature pF, IGeometry pGeo) { int index; index = pF.Fields.FindField("Shape"); IGeometryDef pGeometryDef; pGeometryDef = pF.Fields.get_Field(index).GeometryDef as IGeometryDef; if (pGeometryDef.HasZ) { IZAware pZAware = (IZAware)pGeo; pZAware.ZAware = true; //IZ iz1 = (IZ)pGeo; //iz1.SetConstantZ(0); ?//將Z值設置為0 //在ArcEngine10.2中用下面的兩行代碼來設置 IPoint point = (IPoint)pGeo; point.Z = 0; } else { IZAware pZAware = (IZAware)pGeo; pZAware.ZAware = false; } //M值 if (pGeometryDef.HasM) { IMAware pMAware = (IMAware)pGeo; pMAware.MAware = true; } else { IMAware pMAware = (IMAware)pGeo; pMAware.MAware = false; } }//function轉載于:https://www.cnblogs.com/Joetao/articles/6677946.html
總結
以上是生活随笔為你收集整理的The Geometry has no Z values 解决办法(转载)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: td 中连续数字或连续英文内容不自动换行
- 下一篇: 2017.4.7 e.toString(