ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

ArcMap

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • Extensions

Copy Features

  • Summary
  • Usage
  • Syntax
  • Code sample
  • Environments
  • Licensing information

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.

Syntax

arcpy.management.CopyFeatures(in_features, out_feature_class, {config_keyword}, {spatial_grid_1}, {spatial_grid_2}, {spatial_grid_3})
ParameterExplanationData 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.

Feature Class
config_keyword
(Optional)

Geodatabase configuration keyword to be applied if the output is a geodatabase.

String
spatial_grid_1
(Optional)

The Output Spatial Grid 1, 2, and 3 parameters apply only to file geodatabases and certain enterprise geodatabase feature classes. If you are unfamiliar with setting grid sizes, leave these options as 0,0,0 and ArcGIS will compute optimal sizes for you. For more information about this parameter, refer to the Add Spatial Index tool documentation.

Double
spatial_grid_2
(Optional)

Cell size of the second spatial grid. Leave the size at 0 if you only want one grid. Otherwise, set the size to at least three times larger than Output Spatial Grid 1.

Double
spatial_grid_3
(Optional)

Cell size of the third spatial grid. Leave the size at 0 if you only want two grids. Otherwise, set the size to at least three times larger than Output Spatial Grid 2.

Double

Code sample

CopyFeatures example (Python window)

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

import arcpy
arcpy.env.workspace = "C:/data"
arcpy.CopyFeatures_management("climate.shp", "C:/output/output.gdb/climate")
CopyFeatures example 2 (stand-alone script)

The following stand-alone script demonstrates how to use CopyFeatures 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()
 
# Execute 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.CopyFeatures_management(shapefile, out_featureclass)

Environments

  • Current Workspace
  • Scratch Workspace
  • Output Coordinate System
  • Geographic Transformations
  • Extent
  • XY Resolution
  • XY Tolerance
  • Output has M values
  • M Resolution
  • M Tolerance
  • Output has Z values
  • Default Output Z Value
  • Z Resolution
  • Z Tolerance
  • Qualified Field Names
  • Output CONFIG Keyword
  • Maintain Attachments
  • Auto Commit
  • Output Spatial Grid 1
  • Output Spatial Grid 2
  • Output Spatial Grid 3
  • Output XY Domain
  • Output M Domain
  • Output Z Domain

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics

  • An overview of the Features toolset

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
Copyright © 2021 Esri. | Privacy | Legal