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 class.

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

  • If the name already exists in the output geodatabase, a number will be appended to the end to make the feature class name unique (for example, rivers_1).

  • This tool does not support annotation.

  • Learn more about how to control the output feature class name with the Feature Class to Feature Class tool

Parameters

LabelExplanationData Type
Input Features

One or more feature classes or feature layers to 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 to 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.FeatureClassToGeodatabase_conversion(['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'
 
# Execute FeatureClassToGeodatabase
arcpy.FeatureClassToGeodatabase_conversion(in_features, out_location)

Licensing information

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

Related topics