ArcEngine创建要素类_线类型
public ESRI.ArcGIS.Geodatabase.IFeatureClass CreateFeatureClassForLine(ESRI.ArcGIS.Geodatabase.IWorkspace2 workspace, ESRI.ArcGIS.Geodatabase.IFeatureDataset featureDataset, System.String featureClassName)
{
ESRI.ArcGIS.esriSystem.UID CLSID = null;
ESRI.ArcGIS.esriSystem.UID CLSEXT = null;
System.String strConfigKeyword = null;
if (featureClassName == "") return null; // name was not passed in
ESRI.ArcGIS.Geodatabase.IFeatureClass featureClass;
ESRI.ArcGIS.Geodatabase.IFeatureWorkspace featureWorkspace = (ESRI.ArcGIS.Geodatabase.IFeatureWorkspace)workspace; // Explicit Cast
if (workspace.get_NameExists(ESRI.ArcGIS.Geodatabase.esriDatasetType.esriDTFeatureClass, featureClassName)) //feature class with that name already exists
{
featureClass = featureWorkspace.OpenFeatureClass(featureClassName);
return featureClass;
}
// assign the class id value if not assigned
if (CLSID == null)
{
CLSID = new ESRI.ArcGIS.esriSystem.UIDClass();
CLSID.Value = "esriGeoDatabase.Feature";
//CLSID.Value = "esriGeometryType.esriGeometryPolyline";
}
ESRI.ArcGIS.Geodatabase.IObjectClassDescription objectClassDescription = new ESRI.ArcGIS.Geodatabase.FeatureClassDescriptionClass();
ESRI.ArcGIS.Geodatabase.IFields fields = null;
// if a fields collection is not passed in then supply our own
if (fields == null)
{
// create the fields using the required fields method
fields = objectClassDescription.RequiredFields;
ESRI.ArcGIS.Geodatabase.IFieldsEdit fieldsEdit = (ESRI.ArcGIS.Geodatabase.IFieldsEdit)fields; // Explicit Cast
ESRI.ArcGIS.Geodatabase.IField field = new ESRI.ArcGIS.Geodatabase.FieldClass();
// create a user defined text field
ESRI.ArcGIS.Geodatabase.IFieldEdit fieldEdit = (ESRI.ArcGIS.Geodatabase.IFieldEdit)field; // Explicit Cast
// setup field properties
fieldEdit.Name_2 = "ZBDID";
fieldEdit.Type_2 = ESRI.ArcGIS.Geodatabase.esriFieldType.esriFieldTypeString;
fieldEdit.IsNullable_2 = true;
fieldEdit.AliasName_2 = "坐标编号";
fieldEdit.DefaultValue_2 = ";
fieldEdit.Editable_2 = true;
fieldEdit.Length_2 = ;
// add field to field collection
fieldsEdit.AddField(field);
fields = (ESRI.ArcGIS.Geodatabase.IFields)fieldsEdit; // Explicit Cast
}
System.String strShapeField = "";
// locate the shape field
; j < fields.FieldCount; j++)
{
if (fields.get_Field(j).Type == ESRI.ArcGIS.Geodatabase.esriFieldType.esriFieldTypeGeometry)
{
//strShapeField = fields.get_Field(j).Name;
IField shapeField = fields.get_Field(j);
strShapeField = fields.get_Field(j).Name;
IGeometryDef geometryDef = shapeField.GeometryDef;
IGeometryDefEdit geometryDefEdit = (IGeometryDefEdit)geometryDef;
// Alter the feature class geometry type to lines (default is polygons).
geometryDefEdit.GeometryType_2 = esriGeometryType.esriGeometryPolyline;
geometryDefEdit.HasM_2 = true;
geometryDefEdit.GridCount_2 = ;
// Set the first grid size to zero and allow ArcGIS to determine a valid grid size.
geometryDefEdit.set_GridSize(, );
ISpatialReferenceFactory3 spatialReferenceFactory = new SpatialReferenceEnvironmentClass();
geometryDefEdit.SpatialReference_2 = spatialReferenceFactory.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_Beijing1954);
break;
}
}
// Use IFieldChecker to create a validated fields collection.
ESRI.ArcGIS.Geodatabase.IFieldChecker fieldChecker = new ESRI.ArcGIS.Geodatabase.FieldCheckerClass();
ESRI.ArcGIS.Geodatabase.IEnumFieldError enumFieldError = null;
ESRI.ArcGIS.Geodatabase.IFields validatedFields = null;
fieldChecker.ValidateWorkspace = (ESRI.ArcGIS.Geodatabase.IWorkspace)workspace;
fieldChecker.Validate(fields, out enumFieldError, out validatedFields);
// The enumFieldError enumerator can be inspected at this point to determine
// which fields were modified during validation.
// finally create and return the feature class
if (featureDataset == null)// if no feature dataset passed in, create at the workspace level
{
featureClass = featureWorkspace.CreateFeatureClass(featureClassName, validatedFields, CLSID, CLSEXT, ESRI.ArcGIS.Geodatabase.esriFeatureType.esriFTSimple, strShapeField, strConfigKeyword);
}
else
{
featureClass = featureDataset.CreateFeatureClass(featureClassName, validatedFields, CLSID, CLSEXT, ESRI.ArcGIS.Geodatabase.esriFeatureType.esriFTSimple, strShapeField, strConfigKeyword);
}
return featureClass;
}
ArcEngine创建要素类_线类型的更多相关文章
- ArcGIS创建要素类
在使用ARCGIS软件进行工作时,免不了要建立地理数据库和要素类之类的.一下是我创建文件地理数据库并在数据库中创建要素类写相关步骤: 1.启动软件,可以使用ARCCatalog直接进行创建也可以使用A ...
- 用ArcMap在PostgreSQL中创建要素类需要执行”create enterprise geodatabase”吗
问:用Acmap在PostgreSQL中创建要素类需要执行"create enterprise geodatabase"吗? 关于这个问题,是在为新员工做postgresql培训后 ...
- Geodatabase - 创建要素类.
在NET中,会遇到以“_2”结尾的属性,这些属性是可写的. 以下代码在已有工作空间下,创建一个新的点要素类: //例如,personalDBPath=@"G:\doc\gis\1.400\d ...
- arcengine新建要素类
ArcGIS里面新建数据集,看起来简单,平时都是默认创建,实际上好多细节问题我们都没注意到 一.在数据集上新建要素类: How to create a feature class within a f ...
- ArcEngine 创建要素,删除要素,生成网格,渲染图层(VB)
示例代码:https://github.com/yu969890202/ArcEngine/tree/master/WinFrom_ArcEngine_PointDistribution博客后面有两张 ...
- AE二次开发中几个功能速成归纳(符号设计器、创建要素、图形编辑、属性表编辑、缓冲区分析)
/* * 实习课上讲进阶功能所用文档,因为赶时间从网上抄抄改改,凑合能用,记录一下以备个人后用. * * ----------------------------------------------- ...
- ArcEngine 创建线要素图层
在创建要素图层的时候,默认的几何类型是Polygon: Dim objectClassDescription As IObjectClassDescription = New FeatureClass ...
- ArcGIS 网络分析[1.1] 创建用于网络分析用的线类型shp文件[这个太基础了吧!]
具体的准备,在上一篇就说过了,不再赘述. 阅读本篇前,需要的预备知识是:ArcGIS创建各种矢量数据的方法,了解地理坐标与投影坐标 本篇只创建单一的线数据,至于点数据,以后进行复杂的网络分析时再添加进 ...
- arcengine 要素类的复制
转自原文arcengine 要素类的复制 using System; using System.Collections.Generic; using System.Text; using ESRI.A ...
随机推荐
- MongoDB管理
前几篇文章都是从开发和使用的角度了解了MongoDB的各个知识点,这篇文章将从MongoDB管理的角度入手,了解MongoDB管理所要了解的基本知识. 数据库命令 在前面几篇文章中,已经接触了一些数据 ...
- js中forEach,for in,for of的区别
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- Android实现图片缩放示例
package com.example.demo; import android.os.Bundle; import android.app.Activity; import android.grap ...
- jumpserver安装及使用教程
我自己是jumpserver的新手,以下两个链接是比较好的教程: 安装教程:http://blog.csdn.net/wanglei_storage/article/details/51001810 ...
- Redis 未授权访问漏洞(附Python脚本)
0x01 环境搭建 #下载并安装 cd /tmp wget http://download.redis.io/releases/redis-2.8.17.tar.gz tar xzf redis-.t ...
- [Command] alias - 别名
alias 命令可以让用户使用预置的字符串来执行系统命令. 命令是指用户输入指令指示电脑完成工作.命令一般在命令行输入,以回车键完成输入.命令被传递给shell.shell是类Unix操作系统提供的纯 ...
- RabbitMq 之简单队列
简单队列类似于我们的生产者,消费者, 一个生产者,对应一个消费者. 直接上代码: package com.j1.rabbitmq.simple; import com.j1.rabbitmq.util ...
- 微信小程序--消息推送配置Token令牌错误校验失败如何解决
微信开放第三方API接口, 申请地址: https://mp.weixin.qq.com/advanced/advanced?action=interface&t=advanced/inter ...
- windows桌面通知区域不显示音量图标的解决方法
在windows系统桌面通知区域一般都是显示的输入法.电源.网络.音量及托盘的应用程序等内容 通知区域图标显示与否与控制面板的通知区域图标的设置有关,我们有时会遇到通知区域不显示个别图标的情况,如不显 ...
- 【CF802C】Heidi and Library (hard) 费用流
[CF802C]Heidi and Library (hard) 题意:有n个人依次来借书,第i人来的时候要求书店里必须有种类为ai的书,种类为i的书要花费ci块钱购入.而书店的容量只有k,多余的书只 ...