当前位置:网站首页>ArcEngine(八)用IWorkspaceFactory加载矢量数据
ArcEngine(八)用IWorkspaceFactory加载矢量数据
2022-08-03 07:28:00 【稻田里展望者】
private void iWorkSpaceToolStripMenuItem_Click(object sender, EventArgs e)
{
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Title = "加载shapefile数据";//设置title
openFileDialog.Filter = "(*.shp)|*.shp";//设置过滤模式
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
//设置路径
string fullPath = openFileDialog.FileName;//全部路径
string path = fullPath.Substring(0, fullPath.LastIndexOf("\\"));//截取字符串:除了名称之前的数据
string name = fullPath.Substring(fullPath.LastIndexOf("\\") + 1);//一直截取到末尾
}
IWorkspaceFactory workspaceFactory = new ShapefileWorkspaceFactoryClass();
IFeatureWorkspace featureworkspace = workspaceFactory.OpenFromFile(path, 0) as IFeatureWorkspace;
IFeatureLayer featurelayer = new FeatureLayerClass();
featurelayer.FeatureClass = featureworkspace.OpenFeatureClass(name);
featurelayer.Name = featurelayer.FeatureClass.AliasName;
if (MessageBox.Show("要素类已打开,名称为"+featurelayer.Name+",是否加载进地图?","提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Question)==DialogResult.OK)
{
MapControl.AddLayer(featurelayer);
MapControl.Refresh();
}
}
边栏推荐
猜你喜欢
DSP Trick:向量长度估算
华为设备配置BFD多跳检测
excel高级绘图技巧100讲(二十一)- Excel层叠柱形图
How to choose a reliable and formal training institution for the exam in September?
加载properties文件,容器总结
pyspark---encode the suuid interval (based on the number of exposures and clicks)
【图像去雾】基于matlab暗通道和非均值滤波图像去雾【含Matlab源码 2011期】
ViewModel 记录下 +
一文搞懂什么是@Component和@Bean注解以及如何使用
Shell运维开发基础(一)
随机推荐
[ 漏洞复现篇 ] yapi 代码执行 getshell 漏洞复现详解
熊市中预言机,牛市中的战斗机,藏宝计划起飞,坐稳扶好!
Postman will return to the interface to generate a json file to the local
C语言实现树的底层遍历--超简代码
“碳中和”愿景下,什么样的数据中心才是我们需要的?
2022用户画像构建
智能客服,还有多少AI泡沫?
如何让背景色在任何设备宽高都能填充整个屏幕
tolower函数
Haisi project summary
23届微软秋招内推
学习Glide 常用场景的写法 +
boot-SSE
requests库
mysql 8.0.12 安装配置方法并--设置修改密码
postman将接口返回结果生成csv文件到本地
Karatsuba大数乘法的Verilog实现
REST学习
jolt语法
实时目标检测新高地之#YOLOv7#更快更强的目标检测器