Label | Explanation | Data Type |
Input Features | The features to be copied. | Feature Layer |
Output Feature Class | The feature class which will be created and to which the features will be copied. | Feature Class |
Configuration Keyword (Optional) | Geodatabase configuration keyword to be applied if the output is a geodatabase. | String |
Output Spatial Grid 1 (Optional) | This parameter has been deprecated in ArcGIS AllSource. Any value you enter is ignored. | Double |
Output Spatial Grid 2 (Optional) | This parameter has been deprecated in ArcGIS AllSource. Any value you enter is ignored. | Double |
Output Spatial Grid 3 (Optional) | This parameter has been deprecated in ArcGIS AllSource. Any value you enter is ignored. | Double |
Summary
Copies features from the input feature class or layer to a new feature class.
Usage
If the input is a layer and has a selection, only the selected features are copied to the output feature class.
Both the geometry and attributes of the Input Features will be copied to the output feature class.
This tool can be used for data conversion as it can read many feature formats (any you can add to a map) and write these to shapefile or geodatabase.
Parameters
arcpy.management.CopyFeatures(in_features, out_feature_class, {config_keyword}, {spatial_grid_1}, {spatial_grid_2}, {spatial_grid_3})
Name | Explanation | Data Type |
in_features | The features to be copied. | Feature Layer |
out_feature_class | The feature class which will be created and to which the features will be copied. | Feature Class |
config_keyword (Optional) | Geodatabase configuration keyword to be applied if the output is a geodatabase. | String |
spatial_grid_1 (Optional) | This parameter has been deprecated in ArcGIS AllSource. Any value you enter is ignored. | Double |
spatial_grid_2 (Optional) | This parameter has been deprecated in ArcGIS AllSource. Any value you enter is ignored. | Double |
spatial_grid_3 (Optional) | This parameter has been deprecated in ArcGIS AllSource. Any value you enter is ignored. | Double |
Code sample
The following Python window script demonstrates how to use the CopyFeatures function in immediate mode.
import arcpy
arcpy.env.workspace = "C:/data"
arcpy.management.CopyFeatures("climate.shp", "C:/output/output.gdb/climate")
The following stand-alone script demonstrates how to use the CopyFeatures function to copy the shapefiles in a folder to a file geodatabase.
# Name: CopyFeatures_Example2.py
# Description: Convert all shapefiles in a folder to geodatabase feature classes
# Import system modules
import arcpy
import os
# Set environment settings
arcpy.env.workspace = "C:/data"
# Set local variables
out_workspace = "c:/output/output.gdb"
# Use ListFeatureClasses to generate a list of shapefiles in the workspace
# shown above.
fc_list = arcpy.ListFeatureClasses()
# Run CopyFeatures for each input shapefile
for shapefile in fc_list:
# Determine the new output feature class path and name
out_featureclass = os.path.join(out_workspace,
os.path.splitext(shapefile)[0])
arcpy.management.CopyFeatures(shapefile, out_featureclass)