• 大小: 91KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-14
  • 语言: C#
  • 标签: AE  二次开发  text  shape  

资源简介

能够将以文本格式组织的坐标转换为shape格式,支持自定义转换 坐标起始行、分隔符,指定X,Y坐标的列号;可以批量选择多个TXT批量执行转换;开发环境为 :VS2010+ArcGIS10.2 +C#

资源截图

代码片段和文件信息

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

namespace EasyCartography.Text2Shape
{
    public partial class FrmTxt2ShapeConverter : Form
    {
        #region 全局变量
         /// 
        /// 全局变量 存储阅读txt的起始行值
        /// 

        private int iStartRow = 0;
        /// 
        /// 全局变量 存储X值的所在列
        /// 

        private int iX = 1;
        /// 
        /// 全局变量 存储Y值所在列
        /// 

        private int iY = 2;
        /// 
        /// 全局变量 TXT的列分割符号 要求1个字符
        /// 

        private char cSplit=‘‘;
        /// 
        /// 全局变量 存放文本文件的路径
        /// 

        private string[] sFileNames;
        /// 
        /// 全局变量 当前要存储的要素类
        /// 

        private IFeatureClass pFeatureClass;
        #endregion
        #region 构造函数
        /// 
        /// 构造函数
        /// 

        public FrmTxt2ShapeConverter()
        {
            InitializeComponent();
        }
        #endregion

        /// 
        /// 选择文本
        /// 

        /// 
        /// 
        private void button_ChooseTxts_Click(object sender EventArgs e)
        {
            //打开文件对话框
            OpenFileDialog pOpenFileDialog = new OpenFileDialog();
            pOpenFileDialog.Filter = “文本文件(*.txt)|*.txt|所有文件(*.*)|*.*“;
            pOpenFileDialog.Multiselect = true;
            pOpenFileDialog.title = “选择需要构建shape的文本文件“;
            if (pOpenFileDialog.ShowDialog() == DialogResult.OK)
            {
                sFileNames = pOpenFileDialog.FileNames;
                textBox_TxtFilePath.Text = System.IO.Path.GetDirectoryName(pOpenFileDialog.FileNames[0]);                
            }

        }
        /// 
        /// 设置shapefile路径
        /// 

        /// 
        /// 
        private void button_ShapePath_Click(object sender EventArgs e)
        {
            SaveFileDialog pSaveFileDialog = new SaveFileDialog();
            pSaveFileDialog.Filter = “shapefile文件(*.shp)|*.shp|所有文件(*.*)|*.*“;
            pSaveFileDialog.title = “保存shapfile“;
            if (pSaveFileDialog.ShowDialog() == DialogResult.OK) 
            {
                string sSvFileName = pSaveFileDialog.FileName;
                string dir = System.IO.Path.GetDirectoryName(sSvFileName);
                string filename = System.IO.Path.GetFileName(sSvFileName);
                CreatePolygonFeatureClass(dir filename);
                this.textBox_shapePath.Text = sSvFileName;
            }
        }

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

     文件        490  2010-03-17 22:39  EasyCartography.Text2Shape\bin\Debug\EasyCartography.Text2Shape.vshost.exe.manifest

     文件      26112  2018-05-29 08:17  EasyCartography.Text2Shape\bin\Debug\TXT转shapefile工具.exe

     文件      28672  2018-06-16 10:38  EasyCartography.Text2Shape\bin\Debug\文本转shape工具V2.0.exe

     文件      36352  2018-06-16 10:38  EasyCartography.Text2Shape\bin\Debug\文本转shape工具V2.0.pdb

     文件      11608  2018-06-16 10:04  EasyCartography.Text2Shape\bin\Debug\文本转shape工具V2.0.vshost.exe

     文件        490  2010-03-17 22:39  EasyCartography.Text2Shape\bin\Debug\文本转shape工具V2.0.vshost.exe.manifest

     文件      28672  2018-06-16 10:04  EasyCartography.Text2Shape\bin\Debug\文本转shape工具V3.0.exe

     文件       6724  2018-06-15 12:04  EasyCartography.Text2Shape\EasyCartography.Text2Shape.csproj

     文件      15578  2018-06-16 10:32  EasyCartography.Text2Shape\FrmTxt2ShapeConverter.cs

     文件      14931  2018-06-16 09:15  EasyCartography.Text2Shape\FrmTxt2ShapeConverter.Designer.cs

     文件      13093  2018-06-16 09:15  EasyCartography.Text2Shape\FrmTxt2ShapeConverter.resx

     文件     124858  2018-06-14 16:16  EasyCartography.Text2Shape\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       7545  2018-06-16 10:38  EasyCartography.Text2Shape\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件        849  2018-06-16 10:04  EasyCartography.Text2Shape\obj\x86\Debug\EasyCartography.Text2Shape.csproj.FileListAbsolute.txt

     文件        863  2018-06-16 10:04  EasyCartography.Text2Shape\obj\x86\Debug\EasyCartography.Text2Shape.csproj.GenerateResource.Cache

     文件       5312  2018-06-16 10:04  EasyCartography.Text2Shape\obj\x86\Debug\EasyCartography.Text2Shape.FrmTxt2ShapeConverter.resources

     文件        180  2018-06-16 10:04  EasyCartography.Text2Shape\obj\x86\Debug\EasyCartography.Text2Shape.Properties.Resources.resources

     文件      28672  2018-06-16 10:38  EasyCartography.Text2Shape\obj\x86\Debug\文本转shape工具V2.0.exe

     文件      36352  2018-06-16 10:38  EasyCartography.Text2Shape\obj\x86\Debug\文本转shape工具V2.0.pdb

     文件        617  2018-05-24 08:49  EasyCartography.Text2Shape\Program.cs

     文件       1384  2018-05-23 17:31  EasyCartography.Text2Shape\Properties\AssemblyInfo.cs

     文件       2904  2018-05-23 17:31  EasyCartography.Text2Shape\Properties\Resources.Designer.cs

     文件       5612  2018-05-23 17:31  EasyCartography.Text2Shape\Properties\Resources.resx

     文件       1113  2018-05-23 17:31  EasyCartography.Text2Shape\Properties\Settings.Designer.cs

     文件        249  2018-05-23 17:31  EasyCartography.Text2Shape\Properties\Settings.settings

     文件       4286  2018-05-24 11:50  EasyCartography.Text2Shape\text.ico

     目录          0  2018-05-23 17:31  EasyCartography.Text2Shape\obj\x86\Debug\TempPE

     目录          0  2018-06-16 10:38  EasyCartography.Text2Shape\obj\x86\Debug

     目录          0  2018-06-16 10:38  EasyCartography.Text2Shape\bin\Debug

     目录          0  2018-05-23 17:43  EasyCartography.Text2Shape\bin\Release

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

评论

共有 条评论