Feature Class To Geodatabase (Conversion)

Summary

Converts one or more feature classes or feature layers to geodatabase feature classes.

Usage

  • If the input is a layer with selected features, only those selected features will be written to the new output feature classes.

  • The name of the output feature classes will be based on the name of the input feature class. For example, if the input is C:\base\streams.shp, the output feature class will be named streams.

  • If the name of an output feature class already exists in the output geodatabase, and the Allow geoprocessing tools to overwrite existing datasets option is unchecked, a number will be appended to the end of the feature class name to make it unique (for example, rivers_1). If any of the input feature classes have the same name, a number will also be appended to the output feature class names, regardless of the overwrite existing datasets option. Otherwise, the feature class will be overwritten.

  • To transfer domains, subtypes, attribute rules, field groups, and contingent values to the output geodatabase, check the Transfer Geodatabase Field Properties environment.

  • This tool does not support annotation.

Parameters

LabelExplanationData Type
Input Features

One or more feature classes or feature layers that will be imported into a geodatabase.

Feature Layer
Output Geodatabase

The output or destination geodatabase.

Feature Dataset; Workspace

Derived Output

LabelExplanationData Type
Updated Geodatabase

The geodatabase, or geodatabase feature dataset, containing the new feature classes.

Workspace; Feature Dataset

arcpy.conversion.FeatureClassToGeodatabase(Input_Features, Output_Geodatabase)
NameExplanationData Type
Input_Features
[Input_Features,...]

One or more feature classes or feature layers that will be imported into a geodatabase.

Feature Layer
Output_Geodatabase

The output or destination geodatabase.

Feature Dataset; Workspace

Derived Output

NameExplanationData Type
Derived_Geodatabase

The geodatabase, or geodatabase feature dataset, containing the new feature classes.

Workspace; Feature Dataset

Code sample

FeatureClassToGeodatabase example (Python window)

The following Python window script demonstrates how to use the FeatureClassToGeodatabase function in immediate mode.

import arcpy
arcpy.env.workspace = 'C:/data'
arcpy.conversion.FeatureClassToGeodatabase(['climate.shp', 'majorrds.shp'],
                                           'C:/output/output.gdb')
FeatureClassToGeodatabase example 2 (stand-alone script)

The following stand-alone script demonstrates how to use the FeatureClassToGeodatabase function.

# Name: FeatureClassToGeodatabase_Example2.py
# Description: Use FeatureClassToGeodatabase to copy feature classes
#              to geodatabase format
 
# Import modules
import arcpy
 
# Set environment settings
arcpy.env.workspace = 'C:/data'
 
# Set local variables
in_features = ['climate.shp', 'majorrds.shp']
out_location = 'C:/output/output.gdb'
 
# Run FeatureClassToGeodatabase
arcpy.conversion.FeatureClassToGeodatabase(in_features, out_location)