资源简介

开发环境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个文件信息

评论

共有 条评论