Create Feature Dataset (Data Management)


Creates a feature dataset in the output location—an existing ArcSDE, file geodatabase, or personal geodatabase.



CreateFeatureDataset_management (out_dataset_path, out_name, {spatial_reference})
ParameterExplanationData Type

The ArcSDE, file geodatabase, or personal geodatabase in which the output feature dataset will be created.


The name of the feature dataset to be created.


The spatial reference of the output feature dataset. You can specify the spatial reference in several ways:

  • By entering the path to a .prj file, such as C:/workspace/watershed.prj.
  • By referencing a feature class or feature dataset whose spatial reference you want to apply, such as C:/workspace/myproject.gdb/landuse/grassland.
  • By defining a spatial reference object prior to using this tool, such as sr = arcpy.SpatialReference("C:/data/Africa/Carthage.prj"), which you then use as the spatial reference parameter.

Spatial Reference

Code Sample

CreateFeatureDataset Example 1 (Python Window)

The following Python Window script demonstrates how to use the CreateFeatureDataset function in immediate mode.

import arcpy
from arcpy import env

env.workspace = "C:/data"
arcpy.CreateFileGDB_management("C:/output", "HabitatAnalysis.gdb")
arcpy.CreateFeatureDataset_management("C:/output/HabitatAnalysis.gdb", "analysisresults", "C:/workspace/landuse.prj")
CreateFeatureDataset Example 2 (stand-alone Python Script)

The following Python script demonstrates how to use the CreateFeatureDataset function in a stand-alone script.

# Name: CreateFeaturedataset
# Description: Create a feature dataset 

# Import system modules
import arcpy
from arcpy import env

# Set workspace
env.workspace = "C:/data"

# Set local variables
out_dataset_path = "C:/output/HabitatAnalysis.gdb" 
out_name = "analysisresults"
# Creating a spatial reference object
sr = arcpy.SpatialReference("C:/data/studyarea.prj")

# Create a FileGDB for the fds
arcpy.CreateFileGDB_management("C:/output", "HabitatAnalysis.gdb")

# Execute CreateFeaturedataset 
arcpy.CreateFeatureDataset_management(out_dataset_path, out_name, sr)


Related Topics

Licensing Information

ArcView: Yes
ArcEditor: Yes
ArcInfo: Yes