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

资源简介

有属性查询功能,(类似arcmap的属性查询,但不会高亮显示)并导出查询到的属性记录到一个新shp(类型arcmap的数据导出),可以批量导出。 有个txt文本的程序说明

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.ComponentModel;
using System.Data;
using System.Drawing;

using System.Windows.Forms;

using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.Display;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.Output;
using ESRI.ArcGIS.SystemUI;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.DataSourcesFile;

namespace bianji
{
    class ExportToShp
    {
        public string shpPath;
        //internal void ExportFeatureClassToShp(ESRI.ArcGIS.Geodatabase.IFeatureClass pFeatureClass string strFullPath string filePath)
        //{
        //    //throw new NotImplementedException();
            
            public void ExportFeatureClassToShp(IFeatureClass apFeatureClass string ExportShapeFileNamestring ExportFilePath)
        {
       
            if (apFeatureClass == null)
            {
                MessageBox.Show(“请选择“ “系统提示“);
                return;
            }
            if (ExportShapeFileName == ““)
                return;


            string  ExportFileShortName = System.IO.Path.GetFileNameWithoutExtension(ExportShapeFileName);
            ExportFilePath = System.IO.Path.GetDirectoryName(ExportShapeFileName);
            shpPath = ExportFilePath + “\\“ + ExportFileShortName + “\\“ + ExportFileShortName + “.shp“;
            //设置导出要素类的参数          
            IFeatureClassName pOutFeatureClassName = new FeatureClassNameClass();
            IDataset pOutDataset = (IDataset)apFeatureClass;
            pOutFeatureClassName = (IFeatureClassName)pOutDataset.FullName;
            //创建一个输出shp文件的工作空间
            IWorkspaceFactory pShpWorkspaceFactory = new ShapefileWorkspaceFactoryClass();
            IWorkspaceName pInWorkspaceName = new WorkspaceNameClass();
            pInWorkspaceName = pShpWorkspaceFactory.Create(ExportFilePath ExportFileShortName null 0);

            //创建一个要素集合
            IFeatureDatasetName pInFeatureDatasetName = null;
            //创建一个要素类
            IFeatureClassName pInFeatureClassName = new FeatureClassNameClass();
            IDatasetName pInDatasetClassName;
            pInDatasetClassName = (IDatasetName)pInFeatureClassName;
            pInDatasetClassName.Name = ExportFileShortName;//作为输出参数
            pInDatasetClassName.WorkspaceName = pInWorkspaceName;
            //通过FIELDCHECKER检查字段的合法性,为输出SHP获得字段集合
            long iCounter;
            IFields pOutFields pInFields;
            IFieldChecker pFieldChecker;
            IField pGeoField;
            IEnumFieldError pEnumFieldError = null;
            pInFields = apFeatureClass.Fields;
            pFieldChecker = new FieldChecker();
            pFieldChecker.Validate(pInFields out pEnumFieldError out pOutFields);
            //通过循环查找几何字段
            pGeoField = null;
            for (iCounter = 0; iCounter < pOutFields.FieldCount; iCo

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

     文件       8868  2014-09-02 15:43  bianji\bianji\bianji.csproj

     文件        452  2014-09-02 08:43  bianji\bianji\bianji.csproj.user

     文件      30208  2014-09-03 15:57  bianji\bianji\bin\Debug\bianji.exe

     文件      50688  2014-09-03 15:57  bianji\bianji\bin\Debug\bianji.pdb

     文件      11600  2014-09-03 16:05  bianji\bianji\bin\Debug\bianji.vshost.exe

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

     文件       4697  2014-08-27 16:51  bianji\bianji\ExportToShp.cs

     文件      18941  2014-09-02 14:36  bianji\bianji\Form1.cs

     文件      24772  2014-09-02 08:39  bianji\bianji\Form1.Designer.cs

     文件      11404  2014-09-02 08:39  bianji\bianji\Form1.resx

     文件        356  2014-09-02 15:43  bianji\bianji\Form2.cs

     文件       2285  2014-09-02 15:43  bianji\bianji\Form2.Designer.cs

     文件       5817  2014-09-02 15:43  bianji\bianji\Form2.resx

     文件        160  2014-07-09 17:06  bianji\bianji\MapEngineEditor.cs

     文件        560  2014-09-03 16:05  bianji\bianji\obj\x86\Debug\bianji.csproj.FileListAbsolute.txt

     文件      30208  2014-09-03 15:57  bianji\bianji\obj\x86\Debug\bianji.exe

     文件       3760  2014-09-03 15:57  bianji\bianji\obj\x86\Debug\bianji.Form1.resources

     文件        180  2014-09-03 15:57  bianji\bianji\obj\x86\Debug\bianji.Form2.resources

     文件      50688  2014-09-03 15:57  bianji\bianji\obj\x86\Debug\bianji.pdb

     文件        180  2014-09-03 15:57  bianji\bianji\obj\x86\Debug\bianji.Properties.Resources.resources

     文件     120389  2014-07-09 08:17  bianji\bianji\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       7444  2014-09-03 15:57  bianji\bianji\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件        230  2014-09-03 15:57  bianji\bianji\obj\x86\Debug\GenerateResource.read.1.tlog

     文件       1020  2014-09-03 15:57  bianji\bianji\obj\x86\Debug\GenerateResource.write.1.tlog

     文件     119992  2014-08-25 09:00  bianji\bianji\obj\x86\Debug\ResolveAssemblyReference.cache

     文件        591  2014-07-08 14:15  bianji\bianji\Program.cs

     文件       1362  2014-07-07 14:54  bianji\bianji\Properties\AssemblyInfo.cs

     文件       2863  2014-07-07 14:54  bianji\bianji\Properties\Resources.Designer.cs

     文件       5612  2014-07-07 14:54  bianji\bianji\Properties\Resources.resx

     文件       1092  2014-07-07 14:54  bianji\bianji\Properties\Settings.Designer.cs

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

评论

共有 条评论

相关资源