zoukankan      html  css  js  c++  java
  • 读取线图层上的点,输出为点图层

     1 private void 输出断面点ToolStripMenuItem_Click(object sender, EventArgs e)
     2         {
     3             ESRI.ArcGIS.Geodatabase.IWorkspaceFactory wsf = new ESRI.ArcGIS.DataSourcesFile.ShapefileWorkspaceFactory();
     4             IWorkspace ws = wsf.OpenFromFile(@"F:1-水利项目安徽水利826处理", 0);
     5             
     6             IFeatureClass autoStation = (ws as IFeatureWorkspace).OpenFeatureClass("站点位置线");
     7             IFeatureClass f1 = (ws as IFeatureWorkspace).OpenFeatureClass("断面点");
     8 
     9             int num = autoStation.FeatureCount(null);
    10             //List<IPoint> listpt = new List<IPoint>();
    11             int k = 0;
    12             for (int i = 0; i < num; i++) //for (int i = 0; i < ptc.PointCount; i++)// for (int i = 0; i < num; i++)
    13             {
    14                 IPolyline pl = autoStation.GetFeature(i).Shape as IPolyline;
    15                 IPointCollection ptc = pl as IPointCollection;
    16                 if (i < num - 1)
    17                 {
    18                     IPoint pt = ptc.get_Point(0);
    19                     k++;
    20                     IFeature fea = f1.CreateFeature();
    21                     fea.Shape = pt;
    22                     fea.set_Value(fea.Fields.FindField("Id"), k);
    23                     fea.set_Value(fea.Fields.FindField("longi"), pt.X);
    24                     fea.set_Value(fea.Fields.FindField("latit"), pt.Y);
    25                     fea.Store();
    26 
    27                 }
    28                 else
    29                 {
    30                     IPoint pt = ptc.get_Point(0);
    31                     k++;
    32                     IFeature fea = f1.CreateFeature();
    33                     fea.Shape = pt;
    34                     fea.set_Value(fea.Fields.FindField("Id"), k);
    35                     fea.set_Value(fea.Fields.FindField("longi"), pt.X);
    36                     fea.set_Value(fea.Fields.FindField("latit"), pt.Y);
    37                     fea.Store();
    38                     pt = ptc.get_Point(1);
    39                     k++;
    40                     fea = f1.CreateFeature();
    41                     fea.Shape = pt;
    42                     fea.set_Value(fea.Fields.FindField("Id"), k);
    43                     fea.set_Value(fea.Fields.FindField("longi"), pt.X);
    44                     fea.set_Value(fea.Fields.FindField("latit"), pt.Y);
    45                     fea.Store();
    46                 }
    47             }
    48         }
  • 相关阅读:
    过度使用DBLINK做系统集成会带来的问题
    微服务架构优缺点
    linux + svn提交日志不能显示 日期一直都是1970-01-01
    maven 无法导入ojdbc 的jar包 解决方法
    认识webservice
    tensorflow-gpu2.1缺少libcudnn.so.7
    tensorflow-gpu2.1.0报错 so returning NUMA node zero解决办法
    基于YOLO-V2的行人检测(自训练)附pytorch安装方法
    电脑键盘背景灯无法控制
    pip升级失败
  • 原文地址:https://www.cnblogs.com/fatherZyl/p/3284332.html
Copyright © 2011-2022 走看看