About data conversion and transfer (ZZ) data conversion and transfer

Source: Internet
Author: User
Tags dbase

Slave from EDN: http://edndoc.esri.com/arcobjects/9.2/NET/c45379b5-fbf2-405c-9a36-ea6690f295b2.htm

Overview of data conversion and transfer
Within the geodatabase and geodatabase user interface (UI) libraries, there are five main interfaces involved with transferring datasets from one workspace to another. See the following topics: IFeatureDataConverter and IFeatureDataConverter2

  1. IGeoDBDataTransfer (also known as copy/paste)
  2. IDataset (specifically, the Copy method)
  3. IWorkspaceFactory (specifically, the Copy and Move methods)
  4. IExportOperation

In addition to these classes and interfaces, other options for transferring data exist. the following table gives an overview of the benefits and drawbacks of each)

Method What is transferred Works with query filter Crosses data sources Works with edit session ArcGIS Desktop/
ArcGIS Engine
IFeatureDataConverter [2] Single table, feature class, or feature dataset True True False Both
IGeoDBDataTransfer Multiple tables, feature classes, and/or feature datasets, and domains from geodatabases False False False Both
IExportOperation (GeodatabaseUI) Single table or feature class True True False ArcGIS Desktop
IDataset. Copy Single dataset from afile-based data source False False False Both
IWorkspaceFactory (Copy and Move methods) Local (personal or file) geodatabase, or an SDE connection file False False False Both
IGdbXmlExport and IGdbXmlImport (GeoDatabaseDistributed) Entire workspace (schema, data optional), one or more datasets (schema, data optional), or a record set * False False False Both
IObjectLoader (EditorExt) Individual rows from one dataset to another existing dataset True True True ArcGIS Desktop

* The IGdbXmlExport and IGdbXmlImport interfaces indirectly transfer data between geodatabases by first converting the dataset schema (and, optionally, the data) to Extensible Markup Language (XML ), then from XML back to its original form.

To summarize the previous table, the following situations are appropriate for each method:

  1. IFeatureDataConverter-Use when copying a single dataset or feature dataset and fine-grained control is necessary. this operation des applying a query filter to restrict the rows that are copied, modifying the geometry definition, and applying a configuration key. also useful for transferring datasets from one data source to another.
    IGeoDBDataTransfer-Use when copying one or more geodatabase datasets within the same geodatabase or to another geodatabase.
  2. IExportOperation-Use when copying a single dataset to another workspace and a query filter or selection set is necessary. Also useful for transferring datasets from one data source to another.
    IDataset. Copy-Use when copying a dataset from a file-based data source (such as a shapefile, a database file [DBF] table, or a coverage feature class) to another workspace.
  3. IWorkspaceFactory (Copy and Move methods)-Use when copying or moving an entire local geodatabase or an SDE connection file.
  4. IGdbXmlExport and IGdbXmlImport-Use when XML data is required, or working in a disconnected environment.
  5. IObjectLoader-Use when copying individual rows to an existing dataset.

Name objects and conversion methods
Permission of the application programming interfaces (APIs) for data transfer involve the use of name objects. A name object is a lightweight representation of a dataset or a workspace that provides basic information, such as name and location, without requiring the client to open the dataset or the workspace. A name object can also represent a dataset that doesn't currently exist-they are used in this way with the IFeatureDataConverter and IExportOperation interfaces.

To get a name object for an existing dataset, there are three main options:

  1. Create a name object of the appropriate type (that is, FeatureClassName), cast it to the IDatasetName interface, and set the Name and WorkspaceName properties. this option requires having a name object for the dataset's workspace (and feature dataset, if applicable), but this can be created in a similar fashion.
  2. Generate a name object from an open dataset. after casting a dataset to the IDataset interface, the FullName property can be used to create a name object. this is only applicable for existing datasets, so it isn' t an option in cases where a name object represents a dataset to be created.
  3. Browse the dataset's container for its name object. an example of this is the IWorkspace. datasetNames method, which returns an enumerator of name objects for a specific dataset type. again, this isn't an option for datasets that don't exist.

IFeatureDataConverter and IFeatureDataConverter2
The feature data converter copies a dataset within a workspace or to another workspace (of the same data source type or another data source type ). the IFeatureDataConverter interface allows fine-grained control over the process of converting a dataset, including the following:

  1. Application of a query filter or a spatial filter to restrict the rows transferred to the new dataset.
  2. Application of a query filter's SubFields properties to restrict the fields transferred to the new dataset.
  3. Modification of the fields used in the new dataset (to some extent ). examples of this include changing a field's name and length, and in some cases its type (that is, a double field can be converted to an integer field ).
  4. Providing a new GeometryDef object to replace the existing geometry definition.
  5. Setting a configuration keyword for the dataset. not all of these are applicable to every type of conversion; for example, a table cannot be given a GeometryDef and a query filter cannot be used when converting a feature dataset.

In addition to the capabilities listed previusly, the IFeatureDataConverter2 interface provided des the option of providing a selection set to its ConvertFeatureClass and ConvertTable methods. this is Special useful when creating a new dataset from the selected features of a feature layer.
 
The ConvertFeatureClass and ConvertTable methods of both feature data converter interfaces have an IEnumInvalidObject return type. this enumerator returns the Object IDs for each row or feature that cocould not be successfully converted, along with a short description explaining why the conversion was unsuccessful. an example of why a conversion can fail is when the new dataset contains a string field with a shorter length than its corresponding field in the original dataset, and an object's value for that field exceeds the new length; however, it is important to remember the rejection of an individual row or feature does not cancel the entire operation.
 
The ConvertFeatureDataset method converts a feature dataset from one data source to another; however, relatively few data sources support feature datasets (compared to feature classes and tables ), so it isn't used as often as the other two conversion methods, and in most cases, IGeoDBDataTransfer is a better option for copying a feature dataset. this is especially true because ConvertFeatureDataset only transfers children that are feature classes, whereas IGeoDBDataTransfer includes des other types of datasets, such as relationship classes, topologies, and geometric networks. the options available during conversion are significantly less than the other two methods, but a geometry definition and a configuration key can still be applied. since a feature dataset doesn't include rows or features, this method has a void return type.

(This method can merge the Personal Geodatabase/Geodatabase data set to another new one. The data source can be personal geodmatabase, enterprise geodatabase, dbase file, shapefile, Info File, or ArcInfo Coverage. The target can only be personal geodatabase, enterprise geomdatabase, dbase file, or shapefile. this method supports simple feature classes (point, line, polygon) and does not support Ric network feature classes, SDE 3.x annotation, Geodatabase annotation, coverage annotation ). in addition, Subtypes and domains cannot be retained after being deleted .)

IGeoDBDataTransfer
Using the GeoDBDataTransfer class is equivalent to using the Copy and Paste commands within ArcMap for geodatabase datasets. it allows one or more datasets to be copied within or your SS geodatabases. the options available with this interface are significantly less than those of the IFeatureDataConverter methods, but in seconds cases this simplifies the overhead preparation required for the transfer.
 
One major advantage of this interface over the feature data converter is that it can be used to transfer nearly any type of geodatabase object, including relationship classes, topologies, geometric networks. it also transfers datasets and objects that are associated with a copied object automatically. for example, if this interface is used to transfer a feature class that utilizes domains or representation classes, the process detects these and automatically transfers them with the feature class.
 
The only customizable aspect of this process is through a generated name mapping enumerator. the Transfer method requires a name mapping enumerator (IEnumNameMapping) that can be generated using the GenerateNameMapping method. although the main reason to modify the name mappings is to resolve name conflicts (this occurs if a dataset of the same name exists in the target workspace ), the INameMapping interface exposes properties that can be used to set the names and configuration keywords of the new datasets.

(This method can only be copied within or your SS geodatabases. To put it simple, it can only be converted between access and SDE, and queryfilter is not supported. However, it supports many data types: featureclass, featuredataset, geometry network, table, relationshipclass, and requires fewer parameters .)

IExportOperation
The IExportOperation interface is specified tively a "wrapped" version of the feature data converter. it allows a feature class or a table to be copied within its existing workspace or to another workspace (of the same or another type ). the following are the three main differences between using IExportOperation and IFeatureDataConverter:

  1. It's slightly less retriable. In some cases this may be a disadvantage, but in cases where modification of objects like the fields collection isn' t required, this starts CES the overhead preparation involved.
  2. IExportOperation displays a progress bar during operation. this can be useful for graphical user interface (GUI) applications, but may be inappropriate for console applications or processes intended to be silent. (This is something I really dislike)
  3. IExportOperation is located in the GeodatabaseUI library, meaning it is only availableArcGIS Desktop users(It can only be used in the desktop version, which is a waste).

(It's okay to use IExportOperation to export simple featureclass. There is no way to export Annotation featureclass)

IDataset. Copy
The IDataset. Copy method allows a dataset from File-based data source (such as a shapefile, a DBF table, or a coverage feature class)To be copiedTo another workspace of the same type. There are always Ally no parameter able options in this process, as the method only takes two parameters-the name and workspace of the new dataset.

(The copy data of a ticket is also the data source of file-base, and the target must be of the same type as the data source)

IWorkspaceFactory. Copy and IWorkspaceFactory. Move
IWorkspaceFactory. copy and IWorkspaceFactory. move allow a local geodatabase (a personal or file geodatabase) or an SDE connection file to be copied or moved within the file system. both methods require workspace name objects. see the following:

  1. Copy requires a name object for the existing workspace and for the workspace to be created.
  2. Move only requires a name object for the existing workspace.

(The copy and move methods are calledDestinationFolderTherefore, this method is based on the file system operation)

IObjectLoader. LoadObjects Method

TheISelectionSetObject that the IObjectLoader: LoadObjects method returns is empty if the applyValidation argument is False. if this argument is True, validation is already med, and the ISelectionSet object returned contains the invalid features. the IQueryFilter: SubFields MUST match the IObjectLoader: OutputFields. all fields must have there IsNullable and Editable parameters set to TRUE or the attribute loading will fail.

The order of the fields in the inputTable and outputTable is not important. field mapping doune through the inputQueryFilter: SubFields and the outputFields properties. in this case order is important. the first field in the inputQueryFilter: SubFields maps to the first field in the outputFields, the second in the inputQueryFilter: SubFields maps to the second field in the outputFields and so on. fields not contained in the inputQueryFilter: SubFields will not be mapped. mapped field types must be compadible. text to text, numeric to numeric, etc. type mismatches will cause the interface to fail on execution.
(This method is derived from EditorExt and can only be used on desktop. It adds a element to an existing element type or adds a row object to an existing table, which is different from the data processing process, the batch operation is performed in an edit session. If the number of errors fails, an EnumInvalidObject volume is generated. The data source can be shapefile or personal geodatabase, but CAD cannot be a data source .)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.