Summary
Converts a shapefile, coverage feature class, or geodatabase feature class to a shapefile or geodatabase feature class.
Usage
All fields in the output dataset and the contents of those fields can be controlled using the Field map.
- To change the field order, select a field name and drag it to the preferred position.
- The default data type of an output field is the same as the data type of the first input field (of that name) it encounters. You can manually change the data type at any time to any other valid data type.
- The following merge rules are available: first, last, join, sum, mean, median, mode, minimum, maximum, standard deviation, and count.
- When using the Join merge rule, you can specify a delimiter such as a space, comma, period, dash, and so on. To use a space, make sure the pointer is at the start of the input box and press the Spacebar once.
- You can specify the start and end positions of text fields using the format option.
- Do not perform standard deviation on a single input because values cannot be divided by zero, so standard deviation is not a valid option for single inputs.
An SQL expression can be used to select a subset of features. For further details on the syntax for the Expression parameter, see SQL reference for elements used in query expressions.
When converting geodatabase data that has subtypes or domains to a shapefile, both the subtype and domain codes and descriptions can be included in the output. Use the Transfer field domain descriptions geoprocessing environment to control this behavior. By default, only domain and subtype codes will be included in the output, not descriptions.
Note:
Conversion to shapefiles with subtype and domain descriptions may take more time (slower performance) than without descriptions. If you do not require the subtype and domain descriptions in your shapefile output, it is recommended you use the unchecked default behavior of the Transfer field domain descriptions environment (False or NOT_TRANSFER_DOMAINS in Python) to achieve best performance.
Syntax
arcpy.conversion.FeatureClassToFeatureClass(in_features, out_path, out_name, {where_clause}, {field_mapping}, {config_keyword})
Parameter | Explanation | Data 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) | Controls which attribute fields will be in the output. By default, all fields from the inputs will be included. Fields can be added, deleted, renamed, and reordered, and you can change their properties. Merge rules allow you to specify how values from two or more input fields are merged or combined into a single output value. There are several merge rules you can use to determine how the output field will be populated with values.
In Python, you can use the FieldMappings class to define this parameter. | Field Mappings |
config_keyword (Optional) | Specifies the default storage parameters (configurations) for geodatabases in a relational database management system (RDBMS). This setting is applicable only when using enterprise geodatabase tables. Configuration keywords are set by the database administrator. | String |
Derived Output
Name | Explanation | Data Type |
out_feature_class | The output feature class. | Feature Class |
Code sample
The following Python window script demonstrates how to use the FeatureClassToFeatureClass function in immediate mode.
import arcpy
arcpy.env.workspace = "C:/data/GreenvalleyDB.gdb/Public Buildings"
arcpy.FeatureClassToFeatureClass_conversion("buildings_point",
"C:/output/output.gdb",
"buildings_point")
The following stand-alone script demonstrates how to use the FeatureClassToFeatureClass function.
# Name: FeatureClassToFeatureClass_Example2.py
# Description: Use FeatureClassToFeatureClass with an expression to create a subset
# of the original feature class.
# Import system modules
import arcpy
# Set environment settings
arcpy.env.workspace = "C:/data/GreenvalleyDB.gdb/Public Buildings"
# Set local variables
inFeatures = "buildings_point"
outLocation = "C:/output/output.gdb"
outFeatureClass = "postoffices"
delimitedField = arcpy.AddFieldDelimiters(arcpy.env.workspace, "NAME")
expression = delimitedField + " = 'Post Office'"
# Execute FeatureClassToFeatureClass
arcpy.FeatureClassToFeatureClass_conversion(inFeatures, outLocation,
outFeatureClass, expression)
Environments
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes