当前位置:   article > 正文

ArcGIS Engine,导入数据的几种方式及其效率对比_ifeaturedataconverter2 gdb 同名要素类导入

ifeaturedataconverter2 gdb 同名要素类导入

ArcGIS Engine开发过程中,比较常用并且重要的功能就是数据转换,对于数据转换方法您是否足够清楚?ArcGIS Engine中常用的数据转换方法有哪些?各种转换方法的优缺点是什么?采用哪种方法效率更高?如果您对这些问题感兴趣,那么一定要阅读下面文章,相信一定会让您有所收获。

一、ArcGIS Engine中导入数据的几种方式及其优缺点:

IFeatureDataConverter:细粒度,用于复制单个简单要素类或者要素数据集。优点:可使用QueryFilter(属性和空间均可)进行过滤,可以设置SubFields指定复制哪些字段,可以改变要素类的geometry definition以及设置configuration_keyword。除此之外,还可以在基于文件的数据源(如ShapeFile)与地理数据库之间进行复制。缺点:只能转换简单要素类和要素数据集,无法转换关系类,几何网络,拓扑等复杂对象。

IGeoDBDataTransfer(等同于ArcCatalog中对地理数据库中数据集的复制和粘贴):适用于两个地理数据库之间复制一个或多个数据集。优点:可以一次导入多个数据集,并且能转换几乎所有类型的数据,包括关系类、拓扑、几何网络等复杂对象。缺点:不能进行条件过滤,也不能在基于文件的数据源与地理数据库之间进行复制,即不能实现shapefile与FileGDB、MDB或SDE间的导入导出。

IGdbXmlExport and IGdbXmlImport:使用XML作为中间文件,适用于两个地理数据库之间复制一个或多个数据集。优点:可以在离线下使用。比如SDE往其它地理数据库中进行数据导入,在连接上SDE时生成xml文件,后面即使断开该SDE连接,也可以成功将xml(可仅包括Schema,也可以包含数据)导入到目标库中。还有一个优点是便于数据共享与传输,如果给多个人共享数据,只需拷贝该xml文件即可。

IExportOperation:复制单个数据集到另一个Workspace,是经过包装的IFeatureDataConverter。优点:可以设置QueryFilter以及SelectionSet,可以跨数据源进行转换,比如从ShapeFile到GeoDatabase,并且可以显示进度条。缺点:只能在Desktop产品下使用。

IDataset.Copy:从基于文件的数据源(例如shapefile,dbf或coverage要素类)中复制Dataset到另一个基于文件的数据源。

IWorkspaceFactory(copy或者move):复制或移动整个local geodatabase或SDE 连接文件。

IObjectLoader:往已有数据集中添加记录,仅能在Desktop产品下使用。由于本文仅讨论复制要素类的情况,该接口我们将在下一篇关于Engine中如何往已有要素类中插入数据中讨论。

当然,不要忘了还可以在程序中调用GP工具进行要素类的复制,比如FeatureClassToFeatureClass工具、FeatureClassToGeoDatabase工具、CopyFeatures工具以及Copy工具。

二、效率对比

前面我们介绍了Engine中常用的复制要素类的几种方法及每种方法的优缺点,接下来我们就进行测试,对比一下效率。本文以将FileGDB中含有20万条记录的点要素类导入SDE中为例进行测试。

代码可参考ArcObjects帮助文档

Tips:如果程序中绑定Engine,则需要初始化EngineGeoDB许可(编辑SDE数据需要该许可,当然如果绑定Desktop,也可以使用Standard或者Advanced许可),直接使用Engine许可会报错误。

下面我们就看测试结果吧。

1, 使用IFeatureDataConverter.ConvertFeatureClass将FileGDB中要素类导入SDE中所用时间为:3分钟16秒。为了便于对比,这里没有设置查询条件以及SubFields等。

2,使用IGeoDBTransfer.Transfer将同样数据导入SDE中所用时间为:2分42秒,比第一种方法快34秒。效率提高了17%,目前我导入的数据量仅为20万,相信如果数据量再大些,该方法的效率会更突出。

3,使用IGdbXmlExport将FileGDB中的要素类导出成xml所用时间为:1分55秒,接着使用IGdbXmlImport将生成的xml导入到SDE中所用时间为:4分27秒。两个时间加起来显然并未提高效率,但是生成一次xml,后续可以将其导入任意地理数据库中,便于传输与共享。

4,最后测试使用IExportOperation.ExportFeatureClass 方法,注意该接口只能在Desktop产品下使用,也就是程序中需要绑定Desktop并且初始化Standard或者Advanced许可。执行该方法时会自动出现进度条来显示进度。

所用时间为:3分22秒。可见该方法与IFeatureDataConverter所用时间大致相同,也就验证了前面说的“IExportOperation是包装过的IFeatureDataConverter”说法,如果您的程序中不需要使用MapControl、ToolBarControl等控件,并且需要显示进度条,那么使用这个方法最合适不过了。

其余的IDataset.Copy,IWorkspaceFactory(copy或者move)以及IObjectLoader方法无法实现将FileGDB中的要素类导出到SDE中,所以这里就不做讨论了。接下来我们在程序中调用GP工具测试一下时间。

1,调用FeatureClassToFeatureClass工具,所用时间为3分32秒。

2,调用FeatureClassToGeoDatabase工具,所用时间为3分4秒。

3,调用CopyFeatures工具,所用时间为3分25秒。

4,调用Copy工具,所用时间为2分45秒。

从执行时间上可以发现Copy工具和FeatureClassToGeoDatabase工具用时较少,为大家提供一个参考。

小结:执行相同操作所花时间的长短虽然是一个程序是否可优化的考量因素,但是最重要的是实际需求,比如IGeoDBDataTransfer虽然较IFeatureDataConverter用时短,但是如果想在复制过程中进行查询或者设置SubFields,再或者要将shapeFile导入SDE中,那么就只能使用IFeatureDataConverter了。

说了这么多,前面的东西是否又忘了呢,不要紧,文章最后将之前提到的使用AO接口导入数据的方法汇总如下:

  1. using ESRI.ArcGIS.Catalog;
  2. using ESRI.ArcGIS.DataSourcesGDB;
  3. using ESRI.ArcGIS.esriSystem;
  4. using ESRI.ArcGIS.Geodatabase;
  5. using ESRI.ArcGIS.GeoDatabaseDistributed;
  6. using ESRI.ArcGIS.GeoDatabaseUI;
  7. using ESRI.ArcGIS.Geoprocessing;
  8. using ESRI.ArcGIS.Geoprocessor;
  9. using System;
  10. using System.Collections.Generic;
  11. using System.ComponentModel;
  12. using System.Data;
  13. using System.Diagnostics;
  14. using System.Drawing;
  15. using System.Linq;
  16. using System.Text;
  17. using System.Threading.Tasks;
  18. using System.Windows.Forms;
  19. namespace convertingData
  20. {
  21. public partial class Form1 : Form
  22. {
  23. public Form1()
  24. {
  25. InitializeComponent();
  26. }
  27. string sdePath = @"C:\Users\Xinying\AppData\Roaming\ESRI\Desktop10.4\ArcCatalog\Connection to 192.168.220.132.sde";
  28. string fileGDBPath = Application.StartupPath + "\\test.gdb";
  29. string sourceFCName = "testPoint_20w";
  30. string targetFCName = "testPoint_20w_sde";
  31. string outputXmlFile = Application.StartupPath + "\\workspaceGDB.XML";
  32. private void iFeatureDataConverterToolStripMenuItem_Click(object sender, EventArgs e)
  33. {
  34. Stopwatch myWatch = Stopwatch.StartNew();
  35. ConvertFileGDBToSDE(fileGDBPath, sourceFCName, targetFCName);
  36. myWatch.Stop();
  37. string time = myWatch.Elapsed.TotalMinutes.ToString();
  38. MessageBox.Show(time + " Minutes");
  39. }
  40. public void ConvertFileGDBToSDE(string fileGDBPath, string sourceFCName, string targetFCName)
  41. {
  42. // Create a name object for the source (fileGDB) workspace and open it.
  43. IWorkspaceName sourceWorkspaceName = getWorkspaceName("esriDataSourcesGDB.FileGDBWorkspaceFactory", fileGDBPath);
  44. IName sourceWorkspaceIName = (IName)sourceWorkspaceName;
  45. IWorkspace sourceWorkspace = (IWorkspace)sourceWorkspaceIName.Open();
  46. // Create a name object for the target (SDE) workspace and open it.
  47. IWorkspaceName targetWorkspaceName = getWorkspaceName("esriDataSourcesGDB.SdeWorkspaceFactory", sdePath);
  48. IName targetWorkspaceIName = (IName)targetWorkspaceName;
  49. IWorkspace targetWorkspace = (IWorkspace)targetWorkspaceIName.Open();
  50. // Create a name object for the source dataset.
  51. IFeatureClassName sourceFeatureClassName = getFeatureClassName(sourceWorkspaceName, sourceFCName);
  52. // Create a name object for the target dataset.
  53. IFeatureClassName targetFeatureClassName = getFeatureClassName(targetWorkspaceName, targetFCName);
  54. // Open source feature class to get field definitions.
  55. IName sourceName = (IName)sourceFeatureClassName;
  56. IFeatureClass sourceFeatureClass = (IFeatureClass)sourceName.Open();
  57. // Create the objects and references necessary for field validation.
  58. IFieldChecker fieldChecker = new FieldCheckerClass();
  59. IFields sourceFields = sourceFeatureClass.Fields;
  60. IFields targetFields = null;
  61. IEnumFieldError enumFieldError = null;
  62. // Set the required properties for the IFieldChecker interface.
  63. fieldChecker.InputWorkspace = sourceWorkspace;
  64. fieldChecker.ValidateWorkspace = targetWorkspace;
  65. // Validate the fields and check for errors.
  66. fieldChecker.Validate(sourceFields, out enumFieldError, out targetFields);
  67. if (enumFieldError != null)
  68. {
  69. // Handle the errors in a way appropriate to your application.
  70. Console.WriteLine("Errors were encountered during field validation.");
  71. }
  72. // Find the shape field.
  73. String shapeFieldName = sourceFeatureClass.ShapeFieldName;
  74. int shapeFieldIndex = sourceFeatureClass.FindField(shapeFieldName);
  75. IField shapeField = sourceFields.get_Field(shapeFieldIndex);
  76. // Get the geometry definition from the shape field and clone it.
  77. IGeometryDef geometryDef = shapeField.GeometryDef;
  78. IClone geometryDefClone = (IClone)geometryDef;
  79. IClone targetGeometryDefClone = geometryDefClone.Clone();
  80. IGeometryDef targetGeometryDef = (IGeometryDef)targetGeometryDefClone;
  81. // Cast the IGeometryDef to the IGeometryDefEdit interface.
  82. IGeometryDefEdit targetGeometryDefEdit = (IGeometryDefEdit)targetGeometryDef;
  83. // Set the IGeometryDefEdit properties.
  84. //targetGeometryDefEdit.GridCount_2 = 1;
  85. //targetGeometryDefEdit.set_GridSize(0, 0.75);
  86. // Create a query filter to only select features you want to convert
  87. IQueryFilter queryFilter = new QueryFilterClass();
  88. // Create the converter and run the conversion.
  89. IFeatureDataConverter featureDataConverter = new FeatureDataConverterClass();
  90. IEnumInvalidObject enumInvalidObject = featureDataConverter.ConvertFeatureClass
  91. (sourceFeatureClassName, queryFilter, null, targetFeatureClassName,
  92. targetGeometryDef, targetFields, "", 1000, 0);
  93. // Check for errors.
  94. IInvalidObjectInfo invalidObjectInfo = null;
  95. enumInvalidObject.Reset();
  96. while ((invalidObjectInfo = enumInvalidObject.Next()) != null)
  97. {
  98. // Handle the errors in a way appropriate to the application.
  99. Console.WriteLine("Errors occurred for the following feature: {0}",
  100. invalidObjectInfo.InvalidObjectID);
  101. }
  102. }
  103. //"esriDataSourcesGDB.FileGDBWorkspaceFactory"
  104. //"esriDataSourcesFile.ShapefileWorkspaceFactory"
  105. //"esriDataSourcesGDB.SdeWorkspaceFactory"
  106. private IWorkspaceName getWorkspaceName(string WorkspaceFactoryProgID, string PathName)
  107. {
  108. IWorkspaceName workspaceName = new WorkspaceNameClass
  109. {
  110. WorkspaceFactoryProgID = WorkspaceFactoryProgID,
  111. PathName = PathName
  112. };
  113. return workspaceName;
  114. }
  115. private IFeatureClassName getFeatureClassName(IWorkspaceName WorkspaceName, string Name)
  116. {
  117. // Create a name object for the dataset.
  118. IFeatureClassName featureClassName = new FeatureClassNameClass();
  119. IDatasetName datasetName = (IDatasetName)featureClassName;
  120. datasetName.Name = Name;
  121. datasetName.WorkspaceName = WorkspaceName;
  122. return featureClassName;
  123. }
  124. private void iGeoDBTransferToolStripMenuItem_Click(object sender, EventArgs e)
  125. {
  126. Stopwatch myWatch = Stopwatch.StartNew();
  127. TansferFileGDBToSDE(fileGDBPath, sourceFCName);
  128. myWatch.Stop();
  129. string time = myWatch.Elapsed.TotalMinutes.ToString();
  130. MessageBox.Show(time + " Minutes");
  131. }
  132. public void TansferFileGDBToSDE(string fileGDBPath, string sourceFCName)
  133. {
  134. // Create workspace name objects.
  135. IWorkspaceName sourceWorkspaceName = getWorkspaceName("esriDataSourcesGDB.FileGDBWorkspaceFactory", fileGDBPath);
  136. // Create a name object for the target (SDE) workspace and open it.
  137. IWorkspaceName targetWorkspaceName = getWorkspaceName("esriDataSourcesGDB.SdeWorkspaceFactory", sdePath);
  138. IName targetName = (IName)targetWorkspaceName;
  139. // Create a name object for the source dataset.
  140. IFeatureClassName sourceFeatureClassName = getFeatureClassName(sourceWorkspaceName, sourceFCName);
  141. IName sourceName = (IName)sourceFeatureClassName;
  142. // Create an enumerator for source datasets.
  143. IEnumName sourceEnumName = new NamesEnumeratorClass();
  144. IEnumNameEdit sourceEnumNameEdit = (IEnumNameEdit)sourceEnumName;
  145. // Add the name object for the source class to the enumerator.
  146. sourceEnumNameEdit.Add(sourceName);
  147. // Create a GeoDBDataTransfer object and a null name mapping enumerator.
  148. IGeoDBDataTransfer geoDBDataTransfer = new GeoDBDataTransferClass();
  149. IEnumNameMapping enumNameMapping = null;
  150. // Use the data transfer object to create a name mapping enumerator.
  151. Boolean conflictsFound = geoDBDataTransfer.GenerateNameMapping(sourceEnumName,
  152. targetName, out enumNameMapping);
  153. enumNameMapping.Reset();
  154. // Check for conflicts.
  155. if (conflictsFound)
  156. {
  157. // Iterate through each name mapping.
  158. INameMapping nameMapping = null;
  159. while ((nameMapping = enumNameMapping.Next()) != null)
  160. {
  161. // Resolve the mapping's conflict (if there is one).
  162. if (nameMapping.NameConflicts)
  163. {
  164. nameMapping.TargetName = nameMapping.GetSuggestedName(targetName);
  165. }
  166. // See if the mapping's children have conflicts.
  167. IEnumNameMapping childEnumNameMapping = nameMapping.Children;
  168. if (childEnumNameMapping != null)
  169. {
  170. childEnumNameMapping.Reset();
  171. // Iterate through each child mapping.
  172. INameMapping childNameMapping = null;
  173. while ((childNameMapping = childEnumNameMapping.Next()) != null)
  174. {
  175. if (childNameMapping.NameConflicts)
  176. {
  177. childNameMapping.TargetName = childNameMapping.GetSuggestedName(targetName);
  178. }
  179. }
  180. }
  181. }
  182. }
  183. // Start the transfer.
  184. geoDBDataTransfer.Transfer(enumNameMapping, targetName);
  185. }
  186. private void ExportDatasetToXML(string fileGdbPath, string sourceFCName, string outputXmlFile)
  187. {
  188. // Open the source geodatabase and create a name object for it.
  189. IWorkspaceName sourceWorkspaceName = getWorkspaceName("esriDataSourcesGDB.FileGDBWorkspaceFactory", fileGdbPath);
  190. IFeatureClassName sourceFeatureClassName = getFeatureClassName(sourceWorkspaceName, sourceFCName);
  191. IName sourceName = (IName)sourceFeatureClassName;
  192. // Create a new names enumerator and add the feature dataset name.
  193. IEnumNameEdit enumNameEdit = new NamesEnumeratorClass();
  194. enumNameEdit.Add(sourceName);
  195. IEnumName enumName = (IEnumName)enumNameEdit;
  196. // Create a GeoDBDataTransfer object and create a name mapping.
  197. IGeoDBDataTransfer geoDBDataTransfer = new GeoDBDataTransferClass();
  198. IEnumNameMapping enumNameMapping = null;
  199. geoDBDataTransfer.GenerateNameMapping(enumName, sourceWorkspaceName as IName, out enumNameMapping);
  200. // Create an exporter and export the dataset with binary geometry, not compressed,
  201. // and including metadata.
  202. IGdbXmlExport gdbXmlExport = new GdbExporterClass();
  203. gdbXmlExport.ExportDatasets(enumNameMapping, outputXmlFile, true, false, true);
  204. }
  205. private void ImportXmlWorkspaceDocument(string inputXmlFile)
  206. {
  207. IWorkspaceName targetWorkspaceName = getWorkspaceName("esriDataSourcesGDB.SdeWorkspaceFactory", sdePath);
  208. IName targetName = (IName)targetWorkspaceName;
  209. IWorkspace targetWorkspace = (IWorkspace)targetName.Open();
  210. IGdbXmlImport gdbXmlImport = new GdbImporterClass();
  211. IEnumNameMapping enumNameMapping = null;
  212. Boolean conflictsFound = gdbXmlImport.GenerateNameMapping(inputXmlFile, targetWorkspace, out enumNameMapping);
  213. // Check for conflicts.
  214. if (conflictsFound)
  215. {
  216. // Iterate through each name mapping.
  217. INameMapping nameMapping = null;
  218. enumNameMapping.Reset();
  219. while ((nameMapping = enumNameMapping.Next()) != null)
  220. {
  221. // Resolve the mapping's conflict (if there is one).
  222. if (nameMapping.NameConflicts)
  223. {
  224. nameMapping.TargetName = nameMapping.GetSuggestedName(targetName);
  225. }
  226. // See if the mapping's children have conflicts.
  227. IEnumNameMapping childEnumNameMapping = nameMapping.Children;
  228. if (childEnumNameMapping != null)
  229. {
  230. childEnumNameMapping.Reset();
  231. // Iterate through each child mapping.
  232. INameMapping childNameMapping = null;
  233. while ((childNameMapping = childEnumNameMapping.Next()) != null)
  234. {
  235. if (childNameMapping.NameConflicts)
  236. {
  237. childNameMapping.TargetName =
  238. childNameMapping.GetSuggestedName(targetName);
  239. }
  240. }
  241. }
  242. }
  243. }
  244. // Import the workspace document, including both schema and data.
  245. gdbXmlImport.ImportWorkspace(inputXmlFile, enumNameMapping, targetWorkspace, false);
  246. }
  247. private void exportDatasetToXMLImportToolStripMenuItem_Click(object sender, EventArgs e)
  248. {
  249. Stopwatch myWatch = Stopwatch.StartNew();
  250. ExportDatasetToXML(fileGDBPath, sourceFCName, outputXmlFile);
  251. myWatch.Stop();
  252. string time = myWatch.Elapsed.TotalMinutes.ToString();
  253. MessageBox.Show(time + " Minutes");
  254. Stopwatch myWatch1 = Stopwatch.StartNew();
  255. ImportXmlWorkspaceDocument(outputXmlFile);
  256. myWatch1.Stop();
  257. string time1 = myWatch1.Elapsed.TotalMinutes.ToString();
  258. MessageBox.Show(time1 + " Minutes");
  259. }
  260. private void iExportOperationToolStripMenuItem_Click(object sender, EventArgs e)
  261. {
  262. Stopwatch myWatch = Stopwatch.StartNew();
  263. ExportOperationFileGDBToSDE(fileGDBPath, sourceFCName, targetFCName);
  264. myWatch.Stop();
  265. string time = myWatch.Elapsed.TotalMinutes.ToString();
  266. MessageBox.Show(time + " Minutes");
  267. }
  268. public void ExportOperationFileGDBToSDE(string fileGDBPath, string sourceFCName, string targetFCName)
  269. {
  270. // Create a name object for the source (file GDB) workspace and open it.
  271. IWorkspaceName sourceWorkspaceName = getWorkspaceName("esriDataSourcesGDB.FileGDBWorkspaceFactory", fileGDBPath);
  272. IName sourceWorkspaceIName = (IName)sourceWorkspaceName;
  273. IWorkspace sourceWorkspace = (IWorkspace)sourceWorkspaceIName.Open();
  274. // Create a name object for the target (sde) workspace and open it.
  275. IWorkspaceName targetWorkspaceName = getWorkspaceName("esriDataSourcesGDB.SdeWorkspaceFactory", sdePath);
  276. // Create a name object for the source dataset.
  277. IFeatureClassName sourceFeatureClassName = getFeatureClassName(sourceWorkspaceName, sourceFCName);
  278. // Create a name object for the target dataset.
  279. IFeatureClassName targetFeatureClassName = getFeatureClassName(targetWorkspaceName, targetFCName);
  280. // Open source feature class to get field definitions.
  281. IName sourceName = (IName)sourceFeatureClassName;
  282. IFeatureClass sourceFeatureClass = (IFeatureClass)sourceName.Open();
  283. // Find the shape field.
  284. String shapeFieldName = sourceFeatureClass.ShapeFieldName;
  285. int shapeFieldIndex = sourceFeatureClass.FindField(shapeFieldName);
  286. IField shapeField = sourceFeatureClass.Fields.get_Field(shapeFieldIndex);
  287. // Get the geometry definition from the shape field and clone it.
  288. IGeometryDef geometryDef = shapeField.GeometryDef;
  289. IClone geometryDefClone = (IClone)geometryDef;
  290. IClone targetGeometryDefClone = geometryDefClone.Clone();
  291. IGeometryDef targetGeometryDef = (IGeometryDef)targetGeometryDefClone;
  292. // Cast the IGeometryDef to the IGeometryDefEdit interface.
  293. IGeometryDefEdit targetGeometryDefEdit = (IGeometryDefEdit)targetGeometryDef;
  294. // Set the IGeometryDefEdit properties.
  295. //targetGeometryDefEdit.GridCount_2 = 1;
  296. //targetGeometryDefEdit.set_GridSize(0, 0.75);
  297. // Create a query filter to only select features you want to convert
  298. IQueryFilter queryFilter = new QueryFilterClass();
  299. // Create the converter and run the conversion.
  300. IExportOperation exportOperation = new ExportOperationClass();
  301. exportOperation.ExportFeatureClass(sourceFeatureClassName as IDatasetName, queryFilter, null, targetGeometryDef, targetFeatureClassName, 0);
  302. }
  303. private void ExecuteGP(IGPProcess GPProcess)
  304. {
  305. Geoprocessor gp = new Geoprocessor { OverwriteOutput = true };
  306. try
  307. {
  308. IGeoProcessorResult2 result = gp.Execute(GPProcess, null) as IGeoProcessorResult2;
  309. }
  310. catch (Exception ex)
  311. {
  312. MessageBox.Show(ex.Message, "GP Error");
  313. }
  314. finally
  315. {
  316. System.Text.StringBuilder sb = new System.Text.StringBuilder();
  317. for (int i = 0; i < gp.MessageCount; i++)
  318. sb.AppendLine(gp.GetMessage(i));
  319. if (sb.Capacity > 0) MessageBox.Show(sb.ToString(), "GP Messages");
  320. }
  321. }
  322. private void featureClassToFeatureClassToolStripMenuItem_Click(object sender, EventArgs e)
  323. {
  324. ESRI.ArcGIS.ConversionTools.FeatureClassToFeatureClass featureClassToFeatureClass = new ESRI.ArcGIS.ConversionTools.FeatureClassToFeatureClass();
  325. featureClassToFeatureClass.in_features = fileGDBPath + "\\" + sourceFCName;
  326. featureClassToFeatureClass.out_path = sdePath;
  327. featureClassToFeatureClass.out_name = targetFCName;
  328. ExecuteGP(featureClassToFeatureClass as IGPProcess);
  329. }
  330. private void featureClassToGeodatabaseToolStripMenuItem_Click(object sender, EventArgs e)
  331. {
  332. ESRI.ArcGIS.ConversionTools.FeatureClassToGeodatabase featureClassToGeodatabase = new ESRI.ArcGIS.ConversionTools.FeatureClassToGeodatabase();
  333. featureClassToGeodatabase.Input_Features = fileGDBPath + "\\" + sourceFCName;
  334. featureClassToGeodatabase.Output_Geodatabase = sdePath;
  335. ExecuteGP(featureClassToGeodatabase as IGPProcess);
  336. }
  337. private void copyFeaturesToolStripMenuItem_Click(object sender, EventArgs e)
  338. {
  339. ESRI.ArcGIS.DataManagementTools.CopyFeatures copyFeatures = new ESRI.ArcGIS.DataManagementTools.CopyFeatures();
  340. copyFeatures.in_features = fileGDBPath + "\\" + sourceFCName;
  341. copyFeatures.out_feature_class = sdePath + "\\" + targetFCName;
  342. ExecuteGP(copyFeatures as IGPProcess);
  343. }
  344. private void copyToolStripMenuItem_Click(object sender, EventArgs e)
  345. {
  346. ESRI.ArcGIS.DataManagementTools.Copy copy = new ESRI.ArcGIS.DataManagementTools.Copy();
  347. copy.in_data = fileGDBPath + "\\" + sourceFCName;
  348. copy.out_data = sdePath + "\\" + targetFCName;
  349. ExecuteGP(copy as IGPProcess);
  350. }
  351. }
  352. }

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号