当前位置:网站首页>ArcEngine(十)创建矢量图层
ArcEngine(十)创建矢量图层
2022-08-09 12:52:00 【稻田里展望者】
private void 创建矢量ToolStripMenuItem_Click(object sender, EventArgs e)
{
//工作空间
IWorkspaceFactory workspaceFactory = new ShapefileWorkspaceFactory();
IWorkspace workspace = workspaceFactory.OpenFromFile(@"D:\Data\shp\create", 0);
IFeatureWorkspace featureWorkspace = (IFeatureWorkspace)workspace;
//字段
IFields fields = new Fields();
IFieldsEdit fieldsEdit = (IFieldsEdit)fields;
IField field = new Field();
IFieldEdit fieldEdit = (IFieldEdit)field;
fieldEdit.Name_2 = "SHAPE";
fieldEdit.Type_2 = esriFieldType.esriFieldTypeGeometry;
//几何图形
IGeometryDef geoDef = new GeometryDef();
IGeometryDefEdit geoDefEdit = (IGeometryDefEdit)geoDef;
geoDefEdit.GeometryType_2 = esriGeometryType.esriGeometryPoint;//具体的图形为点
geoDefEdit.SpatialReference_2 = (ISpatialReference)new UnknownCoordinateSystem();//空间参考
fieldEdit.GeometryDef_2 = geoDef;
fieldsEdit.AddField(field);
field = new Field();
fieldEdit = (IFieldEdit)field;
fieldEdit.Name_2 = "id";
fieldEdit.Type_2 = esriFieldType.esriFieldTypeString;
fieldEdit.Length_2 = 10;
fieldsEdit.AddField(field);
IFeatureClass featureClass = featureWorkspace.CreateFeatureClass("newPoint.shp", fields, null, null, esriFeatureType.esriFTSimple, "SHAPE", "");
IFeatureLayer featureLayer = new FeatureLayer();
featureLayer.FeatureClass = featureClass;
featureLayer.Name = "newPoint.shp";
axMapControl1.AddLayer(featureLayer);
}
边栏推荐
猜你喜欢
GIN a preliminary study, the environment is installed
FFmpeg多媒体文件处理(ffmpeg处理流数据的基本概念)
某高校的R语言数据分析期末作业
Redis源码剖析之跳表(skiplist)
Explanation of RTSP protocol
安踏携手华为运动健康共同验证冠军跑鞋 创新引领中国体育
史上最猛“员工”,疯狂吐槽亿万富翁老板小扎:那么有钱,还总穿着同样的衣服!...
uni-app - uview Swiper 轮播图组件点击跳转链接(点击后拿到 item 行数据, 取出数据做操作)
剑指offer,剪绳子2
阿里大淘系模型治理阶段性分享
随机推荐
GIN a preliminary study, the environment is installed
Professor Chen Qiang's "Machine Learning and R Application" course Chapter 13 Assignment
Extract EventBus encapsulation to base class using annotations
jenkins api create custom pipeline
Uni - app - uview Swiper shuffling figure component, click on the links to jump (click to get the item after the row data, remove data operation)
RTSP协议的实现
JVM内存泄漏和内存溢出的原因
LnReader编译
基于 R 语言的深度学习——简单回归案例
19、学习MySQL 索引
The sword refers to Offer 57 - II. and is a continuous positive sequence of s (sliding window)
R 语言 2010.1至2021.12艾滋病每月发病人数 时间序列分析
Professor Chen Qiang's "Machine Learning and R Application" course Chapter 16 Assignment
从NPU-SLAM-EDA技术分析
R语言kaggle 游戏数据探索与可视化
Flutter Getting Started and Advanced Tour (7) GestureDetector
leetcode 20. Valid Parentheses 有效的括号(中等)
ftplib+ tqdm upload and download progress bar
驻波比计算方法
Final assignment of R language data analysis in a university