博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
arcgis创建点图形和线图形
阅读量:4509 次
发布时间:2019-06-08

本文共 4233 字,大约阅读时间需要 14 分钟。

向oracle数据库新增点图形数据:

1  1 public static int CreatePoint(string featureClassName, SCoordinates sCoord, string[] sde=null)  2  2         {
3 3 4 4 if (pFeatureWorkspace == null) 5 5 ConnectSDE(sde); 6 6 OpenFeatureSet(sde); 7 7 IFeatureClass pFeatureClass; 8 8 IFeature pFeature = null; 9 9 IGeometry pGeo = null; 10 10 IPoint pPoint = null; 11 11 int fidIndex; 12 12 int objectID = -1; 13 13 featureClassName = "PMGIS" + "." + featureClassName; 14 14 try 15 15 {
16 16 if (pFeatureClassdic.Keys.Contains(featureClassName)) 17 17 {
18 18 pFeatureClass = pFeatureClassdic[featureClassName]; 19 19 m_WorkspaceEdit.StartEditing(false); 20 20 m_WorkspaceEdit.StartEditOperation(); 21 21 pFeature = pFeatureClass.CreateFeature(); 22 22 //一般Shape图形表都会有2个图形字段 OBJECTID和Shape 23 23 fidIndex = pFeature.Fields.FindField("OBJECTID"); 24 24 objectID = (int)pFeature.get_Value(fidIndex); 25 25 pPoint = new Point(); 26 26 pPoint.X = sCoord.X; 27 27 pPoint.Y = sCoord.Y; 28 28 pPoint.Z = sCoord.Z; 29 29 //pPoint = GetProject(sCoord.X, sCoord.Y); 30 30 pGeo = pPoint as IGeometry; 31 31 IZAware pZAware = (IZAware)pGeo;//创建要素类时,必须选择“Coordinates include z values” 32 32 pZAware.ZAware = true; 33 33 pFeature.Shape = pGeo;//,否则,则会出错 34 34 pFeature.Store(); //保存 35 35 m_WorkspaceEdit.StopEditOperation(); //停止编辑操作 36 36 m_WorkspaceEdit.StopEditing(true); //停止编辑 顺序不能颠倒 37 37 } 38 38 } 39 39 catch (Exception ex) 40 40 {
41 41 42 42 } 43 43 return objectID; 44 44 }

向oracle数据库新增线图形数据:

1         public static int CreateLine(string featureClassName, List
sCoordLst, string[] sde = null) 2 {
3 4 int objectID = -1; 5 if (sCoordLst.Count == 0) 6 return objectID; 7 8 if (pWorkspaceFactory == null || pFeatureWorkspace == null) 9 ConnectSDE(sde); 10 OpenFeatureSet(); 11 IFeatureClass pFeatureClass; 12 IFeature pFeature = null; 13 IPoint pPoint = null; 14 int fidIndex; 15 featureClassName = "PMGIS" + "." + featureClassName; 16 try 17 {
18 if (pFeatureClassdic.Keys.Contains(featureClassName)) 19 {
20 pFeatureClass = pFeatureClassdic[featureClassName]; 21 m_WorkspaceEdit.StartEditing(false); 22 m_WorkspaceEdit.StartEditOperation(); 23 pFeature = pFeatureClass.CreateFeature(); 24 ESRI.ArcGIS.Geometry.Polyline pPolyline = new ESRI.ArcGIS.Geometry.Polyline(); 25 ((IZAware)(pPolyline as IGeometry)).ZAware = true; 26 for (int i = 0; i < sCoordLst.Count; i++) 27 {
28 pPoint = new Point() { X = sCoordLst[i].X, Y = sCoordLst[i].Y, Z = sCoordLst[i].Z }; 29 pPolyline.AddPoint(pPoint); 30 } 31 fidIndex = pFeature.Fields.FindField("OBJECTID"); 32 objectID = (int)pFeature.get_Value(fidIndex); 33 pFeature.Shape = pPolyline as IGeometry; 34 35 pFeature.Store(); 36 m_WorkspaceEdit.StopEditOperation(); 37 m_WorkspaceEdit.StopEditing(true); 38 } 39 } 40 catch (Exception ex) 41 {
42 43 } 44 return objectID; 45 }

转载于:https://www.cnblogs.com/iskyoole/archive/2011/09/25/2190364.html

你可能感兴趣的文章
MAGENTO 与 reindexer
查看>>
数字,字符串,列表及其内置方法
查看>>
iOS遍历数组的同时删除元素
查看>>
小强的HTML5移动开发之路(16)——神奇的拖放功能
查看>>
zookeeper FastLeaderElection
查看>>
Jquery AJAX如何使用Promise/Deferred实现顺序执行?
查看>>
进度条
查看>>
maven 常用命令
查看>>
用户画像
查看>>
HTTP报文(面试会问开发时常用的报文头格式)
查看>>
机器学习从业人员到底做什么?
查看>>
word发表博客的方法
查看>>
Programming Erlang_CHAPTER2_Basic Erlang 学习笔记(2)。
查看>>
Linux基础
查看>>
2019北航软工暑期班作业-预培训个人项目(地铁线路规划)
查看>>
【模板】高精度
查看>>
弱弱的玩下Javascript
查看>>
二叉树相关操作
查看>>
在webstorm开发微信小程序之使用阿里自定义字体图标
查看>>
序列化模块/模块/包
查看>>