• 大小: 80KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-16
  • 语言: C#
  • 标签: txt  数据    

资源简介

C#+ArcEngine:txt坐标数据转Shp矢量点

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.DataSourcesFile;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Geometry;

namespace TxtToShpPoint
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.EngineOrDesktop);
            InitializeComponent();
        }
        //选择Txt文件
        private void btn_TxtPath_Click(object sender EventArgs e)
        {
            OpenFileDialog xjTxtOpenFileDialog = new OpenFileDialog();
            xjTxtOpenFileDialog.Multiselect = false;
            xjTxtOpenFileDialog.title = “打开txt坐标文件“;
            xjTxtOpenFileDialog.Filter = “txt坐标文件(*.txt)|*.txt“;
            if (xjTxtOpenFileDialog.ShowDialog() == DialogResult.OK)
            {
                txt_TxtPath.Text = xjTxtOpenFileDialog.FileName;
            }
        }
        //Shp矢量点保存路径
        private void btn_ShpPath_Click(object sender EventArgs e)
        {
            SaveFileDialog xjShpSaveFileDialog = new SaveFileDialog();
            xjShpSaveFileDialog.Filter = “Shape文件(*.shp)|*.shp“;
            if (File.Exists(txt_TxtPath.Text))
            {
                xjShpSaveFileDialog.FileName = System.IO.Path.GetFileNameWithoutExtension(txt_TxtPath.Text);
            }
            if (xjShpSaveFileDialog.ShowDialog() == DialogResult.OK)
            {
                txt_ShpPath.Text = xjShpSaveFileDialog.FileName;
            }
        }

        //显示保存
        //检查数据和路径
        private bool Check()
        {
            if (txt_TxtPath.Text == ““ || !File.Exists(txt_TxtPath.Text))
            {
                MessageBox.Show(“数据无效哇,重选“ “提示“ MessageBoxButtons.OK);
                return false;
            }
            if (txt_ShpPath.Text == ““ || System.IO.Path.GetExtension(txt_ShpPath.Text).ToLower() != “.shp“)
            {
                MessageBox.Show(“Shp矢量点保存路径无效哇,重选“ “提示“ MessageBoxButtons.OK);
                return false;
            }
            return true;
        }
        //结构体
        struct Point
        {
            public string Name;
            public double X;
            public double Y;
        }
        List xjColumn = new List();
        //获取点数据
        private List GetPoint(string surveyDataFullName)
        {
            try
            {
                List xjList = new List();
                char[] xjchar = new char[] { ‘‘ ‘ ‘ ‘\t‘ };   //常用的分隔符为逗号、空格、制位符
                //读取
                FileStream xjFileStream = new FileStream(surveyDataFullName FileMode.Open);
                StreamReader xjStreamReader = new StreamReader(xjFileStream Encoding.Default);
   

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        187  2016-12-02 11:08  TxtToShpPoint\TxtToShpPoint\App.config

     文件      21504  2016-12-02 11:28  TxtToShpPoint\TxtToShpPoint\bin\Debug\TxtToShpPoint.exe

     文件        187  2016-12-02 11:08  TxtToShpPoint\TxtToShpPoint\bin\Debug\TxtToShpPoint.exe.config

     文件      30208  2016-12-02 11:28  TxtToShpPoint\TxtToShpPoint\bin\Debug\TxtToShpPoint.pdb

     文件      22984  2016-12-02 11:29  TxtToShpPoint\TxtToShpPoint\bin\Debug\TxtToShpPoint.vshost.exe

     文件        187  2016-12-02 11:08  TxtToShpPoint\TxtToShpPoint\bin\Debug\TxtToShpPoint.vshost.exe.config

     文件       7474  2016-12-02 11:28  TxtToShpPoint\TxtToShpPoint\Form1.cs

     文件      13025  2016-12-02 11:28  TxtToShpPoint\TxtToShpPoint\Form1.Designer.cs

     文件      10557  2016-12-02 11:28  TxtToShpPoint\TxtToShpPoint\Form1.resx

     文件     128848  2016-12-02 11:10  TxtToShpPoint\TxtToShpPoint\obj\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       7920  2016-12-02 11:25  TxtToShpPoint\TxtToShpPoint\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件          0  2016-12-02 11:08  TxtToShpPoint\TxtToShpPoint\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs

     文件          0  2016-12-02 11:08  TxtToShpPoint\TxtToShpPoint\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs

     文件          0  2016-12-02 11:08  TxtToShpPoint\TxtToShpPoint\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs

     文件        816  2016-12-02 11:29  TxtToShpPoint\TxtToShpPoint\obj\Debug\TxtToShpPoint.csproj.FileListAbsolute.txt

     文件        975  2016-12-02 11:28  TxtToShpPoint\TxtToShpPoint\obj\Debug\TxtToShpPoint.csproj.GenerateResource.Cache

     文件      65902  2016-12-02 11:26  TxtToShpPoint\TxtToShpPoint\obj\Debug\TxtToShpPoint.csprojResolveAssemblyReference.cache

     文件      21504  2016-12-02 11:28  TxtToShpPoint\TxtToShpPoint\obj\Debug\TxtToShpPoint.exe

     文件       3329  2016-12-02 11:28  TxtToShpPoint\TxtToShpPoint\obj\Debug\TxtToShpPoint.Form1.resources

     文件      30208  2016-12-02 11:28  TxtToShpPoint\TxtToShpPoint\obj\Debug\TxtToShpPoint.pdb

     文件        180  2016-12-02 11:26  TxtToShpPoint\TxtToShpPoint\obj\Debug\TxtToShpPoint.Properties.Resources.resources

     文件        612  2016-12-02 11:18  TxtToShpPoint\TxtToShpPoint\Program.cs

     文件       1346  2016-12-02 11:08  TxtToShpPoint\TxtToShpPoint\Properties\AssemblyInfo.cs

     文件       2878  2016-12-02 11:08  TxtToShpPoint\TxtToShpPoint\Properties\Resources.Designer.cs

     文件       5612  2016-12-02 11:08  TxtToShpPoint\TxtToShpPoint\Properties\Resources.resx

     文件       1100  2016-12-02 11:08  TxtToShpPoint\TxtToShpPoint\Properties\Settings.Designer.cs

     文件        249  2016-12-02 11:08  TxtToShpPoint\TxtToShpPoint\Properties\Settings.settings

     文件       6342  2016-12-02 11:26  TxtToShpPoint\TxtToShpPoint\TxtToShpPoint.csproj

     文件        929  2016-12-02 11:08  TxtToShpPoint\TxtToShpPoint.sln

    ..A..H.     34816  2016-12-02 11:29  TxtToShpPoint\TxtToShpPoint.v11.suo

............此处省略13个文件信息

评论

共有 条评论