Feature Class To Feature Class (Conversion)

License Level:BasicStandardAdvanced

Summary

Converts a shapefile, coverage feature class, or geodatabase feature class to a shapefile or geodatabase feature class.

Usage

Syntax

FeatureClassToFeatureClass_conversion (in_features, out_path, out_name, {where_clause}, {field_mapping}, {config_keyword})
ParameterExplanationData Type
in_features

The feature class or feature layer that will be converted.

Feature Layer
out_path

The location in which the output feature class will be created. This can be either a geodatabase or a folder. If the output location is a folder, the output will be a shapefile.

Workspace;Feature Dataset
out_name

The name of the output feature class.

String
where_clause
(Optional)

An SQL expression used to select a subset of features. For more information on SQL syntax see the help topic SQL reference for query expressions used in ArcGIS.

SQL Expression
field_mapping
(Optional)

The fields and field contents chosen from the input feature class. You can add, rename, or delete output fields as well as set properties such as data type and merge rule.

Learn more about choosing and setting the output fields.

Field Mappings
config_keyword
(Optional)

Specifies the storage parameters (configuration) for geodatabases in file and ArcSDE geodatabases. Personal geodatabases do not use configuration keywords.

ArcSDE configuration keywords for ArcSDE Enterprise Edition are set up by your database administrator.

String

Code Sample

FeatureClassToFeatureClass example (Python window)

The following Python window script demonstrates how to use the FeatureClassToFeatureClass tool in immediate mode.

import arcpy
from arcpy import env
env.workspace = "C:/data/GreenvalleyDB.mdb/Public Buildings"
arcpy.FeatureClassToFeatureClass_conversion("buildings_point", 
                                            "C:/output/output.gdb", 
                                            "buildings_point")
FeatureClassToFeatureClass example 2 (stand-alone script)

The following stand-alone script demonstrates how to use the FeatureClassToFeatureClass tool.

# Name: FeatureClassToFeatureClass_Example2.py
# Description: Use FeatureClassToFeatureClass with an expression to create a subset
#  of the original feature class.  
 
# Import system modules
import arcpy
from arcpy import env
 
# Set environment settings
env.workspace = "C:/data/GreenvalleyDB.mdb/Public Buildings"
 
# Set local variables
inFeatures = "buildings_point"
outLocation = "C:/output/output.gdb"
outFeatureClass = "postoffices"
delimitedField = arcpy.AddFieldDelimiters(env.workspace, "NAME")
expression = delimitedField + " = 'Post Office'"
 
# Execute FeatureClassToFeatureClass
arcpy.FeatureClassToFeatureClass_conversion(inFeatures, outLocation, 
                                            outFeatureClass, expression)

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Yes
ArcGIS for Desktop Standard: Yes
ArcGIS for Desktop Advanced: Yes
3/3/2014