首页 > 代码库 > 爆出错误:The Geometry has no Z values
爆出错误:The Geometry has no Z values
ArcGis添加地图标注,爆出错误:The Geometry has no Z values
解决方法如下:
public bool AddFeature( ESRI.ArcGIS.Geometry.IGeometry geometry,System.Collections.Generic.Dictionary<string ,object> properties) { try { ESRI.ArcGIS.Geodatabase.IFeature feature = _featureLayer.FeatureClass.CreateFeature(); int index; index = feature.Fields.FindField("Shape"); IGeometryDef pGeometryDef; pGeometryDef = feature.Fields.get_Field(index).GeometryDef as IGeometryDef; if (pGeometryDef.HasZ) { IZAware pZAware = (IZAware)geometry; pZAware.ZAware = true; //IZ iz1 = (IZ)geometry; //iz1.SetConstantZ(0); //将Z值设置为0 IPoint point = (IPoint)geometry; point.Z = 0; } else { IZAware pZAware = (IZAware)geometry; pZAware.ZAware = false; } if (pGeometryDef.HasM) { IMAware pMAware = (IMAware)geometry; pMAware.MAware = true; } else { IMAware pMAware = (IMAware)geometry; pMAware.MAware = false; } feature.Shape = geometry; foreach (string key in properties.Keys) { SetFeatueProperty(feature, key, properties[key]); } feature.Store(); return true; } catch (Exception ee) { return false; } }
爆出错误:The Geometry has no Z values
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。