資源簡介
能夠將以文本格式組織的坐標轉換為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個文件信息
評論
共有 條評論