Show Navigation | Hide Navigation
You are here:
Geoprocessing tool reference > Data Management toolbox > Features toolset > Tools

Copy Features (Data Management)

Release 9.2
Last modified November 29, 2010
E-mail This Topic Printable Version Give Us Feedback

Print all topics in : "Tools"


Related Topics

Copies the selected features to a new feature class. If the input features are from a layer which has a selection, then only those features selected for the layer will be copied to the output feature class. If the input features are from a feature class or shapefile, then all features will be copied to the output feature class.


Usage tips

Command line syntax
An overview of the Command Line window
CopyFeatures_management <in_features> <out_feature_class> {config_keyword} {spatial_grid_1} {spatial_grid_2} {spatial_grid_3}

Parameter Explanation Data Type
<in_features>

The features to be copied.

Feature Layer | Raster Catalog Layer
<out_feature_class>

The feature class which will be created and to which the features will be copied. If the output feature class already exists and the overwrite option is set to true, the output will be deleted first. If the output feature class already exists and the overwrite option is set to false, the operation will fail.

Feature Class
{config_keyword}

Geodatabase configuration keyword to be applied, if the output is an ArcSDE geodatabase or file geodatabase. For more information, see the CONFIG keyword environment setting.

String
{spatial_grid_1}

The size of the output feature classe's spatial grid index. The following formats support spatial index grids: personal geodatabase, file geodatabase or ArcSDE geodatabase. If this value is left blank (or 0) a valid grid size will be calculated automatically.

Double
{spatial_grid_2}

The size of the output feature classe's second spatial grid index. This value must be at least 3 times larger than the first index grid. The following formats support more than one spatial index grids: file geodatabase or ArcSDE geodatabase. For more information, see the Add Spatial Index tool. Note that personal geodatabase support only one spatial index grid.

Double
{spatial_grid_3}

The size of the output feature classe's third spatial grid index. This value must be at least 3 times larger than the second index grid. The following formats support more than one spatial index grids: file geodatabase or ArcSDE geodatabase. Note that personal geodatabase support only one spatial index grid.

Double
Data types for geoprocessing tool parameters


Command line example

copyfeatures_management  d:\workspace\roads\arc  d:\workspace\transport.shp

Scripting syntax
About getting started with writing geoprocessing scripts
CopyFeatures_management (in_features, out_feature_class, config_keyword, spatial_grid_1, spatial_grid_2, spatial_grid_3)

Parameter Explanation Data Type
in_features (Required)

The features to be copied.

Feature Layer | Raster Catalog Layer
out_feature_class (Required)

The feature class which will be created and to which the features will be copied. If the output feature class already exists and the overwrite option is set to true, the output will be deleted first. If the output feature class already exists and the overwrite option is set to false, the operation will fail.

Feature Class
config_keyword (Optional)

Geodatabase configuration keyword to be applied, if the output is an ArcSDE geodatabase or file geodatabase. For more information, see the CONFIG keyword environment setting.

String
spatial_grid_1 (Optional)

The size of the output feature classe's spatial grid index. The following formats support spatial index grids: personal geodatabase, file geodatabase or ArcSDE geodatabase. If this value is left blank (or 0) a valid grid size will be calculated automatically.

Double
spatial_grid_2 (Optional)

The size of the output feature classe's second spatial grid index. This value must be at least 3 times larger than the first index grid. The following formats support more than one spatial index grids: file geodatabase or ArcSDE geodatabase. For more information, see the Add Spatial Index tool. Note that personal geodatabase support only one spatial index grid.

Double
spatial_grid_3 (Optional)

The size of the output feature classe's third spatial grid index. This value must be at least 3 times larger than the second index grid. The following formats support more than one spatial index grids: file geodatabase or ArcSDE geodatabase. Note that personal geodatabase support only one spatial index grid.

Double

Data types for geoprocessing tool parameters


Script example

# BatchCopyFeaturesToGDB.py
# Description:
#   Loops through all the coverages in a workspace, finds all the arc 
#   feature classes in those coverages, and copys those features to new
#   feature classes in a personal geodatabase.
# Requirements: Python and the Python win32all extension
# Author: ESRI
# Data 11/11/2004

# Create Geoprocessing Object
import arcgisscripting, sys, os
gp = arcgisscripting.create()

gp.Workspace = "c:\\wksp"
out_gdb = gp.Workspace + "\\gdby.mdb"

# If the output personal gdb does not exist, create it
if not gp.Exists(out_gdb):
    gp.CreatePersonalGDB(os.path.dirname(out_gdb),os.path.basename(out_gdb))

# List the coverages
covs = gp.ListDatasets("","coverage")
cov = covs.Next()
while cov:
    # List of the feature classes
    fcs = gp.ListFeatureClasses("","line",cov)
    fc = fcs.Next()
    while fc:
        try:
            out_name = gp.ValidateTableName("%s_%s" % (cov,fc), out_gdb)
            # Copy this cov's line feature class to a new geodatabase feature class
            gp.CopyFeatures(cov + os.sep + fc, out_gdb + os.sep + out_name)
            print "Successfull converting %s\\%s " % (cov, fc)

        except:
            print "Failed to convert %s\\%s\n%s" % (cov, fc, gp.GetMessages(2))

        # Proceed to the next feature class
        fc = fcs.Next()
    # Proceed to the next coverage
    cov = covs.Next()    

Please visit the Feedback page to comment or give suggestions on ArcGIS Desktop Help.
Copyright © Environmental Systems Research Institute, Inc.