资源简介
开发环境VS2008,坐标点数据为TXT或者excel格式,程序读取坐标点,并转换为shp文件输出,保存后的shp文件可以在其他程序中打开,绘制的是多边形
代码片段和文件信息
using System;
using System.Collections;
using System.Collections.objectModel;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Reflection;
using System.Windows.Forms;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.DataSourcesFile;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.SystemUI;
using ESRI.ArcGIS.Display;
using System.IO;
using System.Data.OleDb;
using SharpMap;
using SharpMap.Data.Providers;
namespace XYtoShp
{
public partial class Form1 : Form
{
IPoint pt = new PointClass();
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender EventArgs e)
{
IAoInitialize m_aoinitialize = new AoInitializeClass();
m_aoinitialize.Initialize(esriLicenseProductCode.esriLicenseProductCodeEngine);
}
private void button1_Click(object sender EventArgs e)
{
if (textBox1.Text == ““ || textBox2.Text == ““ || textBox3.Text == ““ ||
textBox4.Text == ““ || textBox5.Text == ““ || textBox6.Text == ““)
{
MessageBox.Show(“请完善坐标信息!“);
return;
}
if (textBox7.Text == ““ || textBox8.Text == ““ || textBox9.Text == ““ ||
textBox10.Text == ““ || textBox11.Text == ““ || textBox12.Text == ““)
{
MessageBox.Show(“请完善坐标信息!“);
return;
}
if (textBox13.Text == ““)
{
MessageBox.Show(“请选择生成路径!“);
return;
}
axMapControl1.Clearlayers();
//判断生成的文件是否已存在,如果存在,则删掉已存在的文件;
string inSHPpath = textBox13.Text;
string shpDirName = System.IO.Path.GetDirectoryName(inSHPpath);
string shpName1 = System.IO.Path.GetFileNameWithoutExtension(inSHPpath);
string shpFullName = shpName1 + “.shp“;
string prjName = shpName1 + “.prj“;
string dbfName = shpName1 + “.dbf“;
string shxName = shpName1 + “.shx“;
string sbnName = shpName1 + “.sbn“;
string xmlName = shpName1 + “.shp.xml“;
string sbxName = shpName1 + “.sbx“;
if (System.IO.File.Exists(shpDirName + “\\“ + shpFullName))
System.IO.File.Delete(shpDirName + “\\“ + shpFullName);
if (System.IO.File.Exists(shpDirName + “\\“ + prjName))
System.IO.File.Delete(shpDirName + “\\“ + prjName);
if (System.IO.File.Exists(shpDirName + “\\“ + dbfName))
System.IO.File.Delete(shpDirName + “\\“ + dbfName);
if (System.IO.File.Exists(shpDirName + “\\“ + shxName))
System.IO.File.Delete(shpDirName + shxName
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1472 2008-07-31 09:43 XYtoShp\open.jpg
文件 307200 2012-08-03 15:55 XYtoShp\SharpMap.dll
文件 49152 2007-04-04 01:08 XYtoShp\SharpMap.UI.dll
文件 1100392 2007-10-10 09:48 XYtoShp\XYtoShp\bin\Debug\Microsoft.Office.Interop.Excel.dll
文件 64088 2007-10-10 09:48 XYtoShp\XYtoShp\bin\Debug\Microsoft.Vbe.Interop.dll
文件 223800 2007-10-10 09:48 XYtoShp\XYtoShp\bin\Debug\office.dll
文件 307200 2012-08-03 15:55 XYtoShp\XYtoShp\bin\Debug\SharpMap.dll
文件 49152 2007-04-04 01:08 XYtoShp\XYtoShp\bin\Debug\SharpMap.UI.dll
文件 33280 2012-08-14 14:41 XYtoShp\XYtoShp\bin\Debug\XYtoShp.exe
文件 40448 2012-08-14 14:41 XYtoShp\XYtoShp\bin\Debug\XYtoShp.pdb
文件 14328 2012-08-14 14:56 XYtoShp\XYtoShp\bin\Debug\XYtoShp.vshost.exe
文件 490 2007-07-21 01:33 XYtoShp\XYtoShp\bin\Debug\XYtoShp.vshost.exe.manifest
文件 31077 2012-08-14 14:41 XYtoShp\XYtoShp\Form1.cs
文件 26784 2012-08-07 16:23 XYtoShp\XYtoShp\Form1.Designer.cs
文件 13846 2012-08-07 16:23 XYtoShp\XYtoShp\Form1.resx
文件 122536 2012-08-06 09:19 XYtoShp\XYtoShp\obj\Debug\ResolveAssemblyReference.cache
文件 757 2012-08-14 14:56 XYtoShp\XYtoShp\obj\Debug\XYtoShp.csproj.FileListAbsolute.txt
文件 847 2012-08-07 16:23 XYtoShp\XYtoShp\obj\Debug\XYtoShp.csproj.GenerateResource.Cache
文件 33280 2012-08-14 14:41 XYtoShp\XYtoShp\obj\Debug\XYtoShp.exe
文件 5801 2012-08-07 16:23 XYtoShp\XYtoShp\obj\Debug\XYtoShp.Form1.resources
文件 40448 2012-08-14 14:41 XYtoShp\XYtoShp\obj\Debug\XYtoShp.pdb
文件 180 2012-08-06 09:19 XYtoShp\XYtoShp\obj\Debug\XYtoShp.Properties.Resources.resources
文件 1472 2008-07-31 09:43 XYtoShp\XYtoShp\open.jpg
文件 488 2012-08-02 10:47 XYtoShp\XYtoShp\Program.cs
文件 1346 2012-08-02 10:47 XYtoShp\XYtoShp\Properties\AssemblyInfo.cs
文件 2864 2012-08-02 10:47 XYtoShp\XYtoShp\Properties\Resources.Designer.cs
文件 5612 2012-08-02 10:47 XYtoShp\XYtoShp\Properties\Resources.resx
文件 1092 2012-08-02 10:47 XYtoShp\XYtoShp\Properties\Settings.Designer.cs
文件 249 2012-08-02 10:47 XYtoShp\XYtoShp\Properties\Settings.settings
文件 1100392 2007-10-10 09:48 XYtoShp\XYtoShp\XYtoShp\bin\Debug\Microsoft.Office.Interop.Excel.dll
............此处省略59个文件信息
相关资源
- C#导出数据到EXCEL方法谈附和超级无敌
- seafile私有云的api的C#客户端实现
- c#窗体嵌入应用程序
- 游戏账户管理系统
- 利用C#读取DEM数据,求坡度
- C#实现十六进制AES的加解密字节数组工
- wpf全套基础视频+进阶视频
- C#从txt读取数据并保存在数组
- C#将json格式转换成DataTable
- C#实现DES加解密完整类源码
- C#开发资源库
- C#开发实例大全(基础卷/1.69G/光盘)
- c# 熵权法计算权重和算综合得分
- 页面置换算法LRU模拟c#
- c#时间片轮转算法
- c# yv12转换rgb
- 曼哈顿路径预测算法C#寻路
- 基于C#的波形显示控件的实现源码
- C# 斑马标签打印 WEB&WINFORM
- C# TCP服务器客户端通讯源码
- C#窗体小程序,实现文件夹创建、删除
- C#连接Oracle10g,11g,12g所需的DLL无需安
- C#Winform 销售管理系统
- 服务端获取DTU GPRS数据C#
-
Js to CSharp sc
ript converter - 测控课程设计ad转换程序
- Head First C#(第二版)中文版
- 简单的C#课程设计
- 基于讯飞的离线语音识别C#
- 基于C#的五点N次平滑算法
评论
共有 条评论