Geoprocessing field mapping


Purpose
This sample demonstrates how to set up field mapping for tools such as Merge, Table to Table, Feature Class to Feature Class, and Append.

How to use

See How to use ArcGIS samples for help on compiling, setting up the debugger, and running the sample. If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders. However, you will need to update the sample to point to the location of the data once you have extracted all the files.

  1. Provide local data. You need to update the code to reference your dataset and its fields. You also need to update the path to the output table to the location where you want it created.
  2. Compile and run the project.

Additional information

In this sample, a table containing United States (U.S.) census data is converted to a new table. One of the input attributes in the input table is a text field, STFID. This 15-digit value is a unique identifier for all census blocks for the U.S. The value can be broken into four components. The first two digits provide the state code, the next three indicate the county, the following six identify the census tract, and the last four identify the census block.
 
The value 360899912001006 represents the census block (1006) containing the State University of New York at Potsdam in upstate New York (36), in census tract 991200 of the county of St. Lawrence (089). This sample converts this table and also creates a field, TRACTID, because the input data only has the STFID attribute. To do this, the GPFieldMapping object is initialized using the AddTable method to enter the input table. The default IGPFieldMapping object is then modified by creating an IGPFieldMap object, populating its properties, and adding them to the IGPFieldMapping object.


GPFieldMapping/FieldMapping.cs Source file containing code to convert a table using field mapping.
Download the C# files
GPFieldMapping/FieldMapping.vb Source file containing code to convert a table using field mapping.
Download the VB.NET files

Download the files for all languages

See Also:

Mapping fields




Development licensing Deployment licensing
ArcView ArcView
ArcEditor ArcEditor
ArcInfo ArcInfo
Engine Developer Kit Engine Runtime