Create Feature Class (Data Management)

Summary

Creates an empty feature class in a geodatabase or a shapefile in a folder.

Usage

  • The Feature Class Location parameter value (geodatabase or folder) must already exist.

  • This tool creates only simple feature classes such as point, multipoint, polygon, and polyline.

  • A shapefile created by this tool has an integer field named ID. The ID field is not created when you provide a Template Dataset parameter value.

Parameters

LabelExplanationData Type
Feature Class Location

The enterprise or file geodatabase or the folder in which the output feature class will be created. This workspace must already exist.

Workspace; Feature Dataset
Feature Class Name

The name of the feature class to be created.

String
Geometry Type
(Optional)

Specifies the geometry type of the output feature class.

  • PointThe geometry type will be point.
  • MultipointThe geometry type will be multipoint.
  • PolygonThe geometry type will be polygon.
  • PolylineThe geometry type will be polyline.
  • MultipatchThe geometry type will be multipatch.
String
Template Dataset
(Optional)

The feature class or table used as a template to define the attribute fields of the new feature class.

Table View
Has M
(Optional)

Specifies whether the feature class will have linear measurement values (m-values).

  • NoThe output feature class will not have m-values. This is the default.
  • YesThe output feature class will have m-values.
  • Same as the template feature classThe output feature class will have m-values if the dataset specified in the Template Feature Class parameter (template parameter in Python) has m-values.
String
Has Z
(Optional)

Specifies whether the feature class will have elevation values (z-values).

  • NoThe output feature class will not have z-values. This is the default.
  • YesThe output feature class will have z-values.
  • Same as the template feature classThe output feature class will have z-values if the dataset specified in the Template Feature Class parameter (template parameter in Python) has z-values.
String
Coordinate System
(Optional)

The spatial reference of the output feature dataset. On the Spatial Reference Properties dialog box, you can select, import, or create a new coordinate system. To set aspects of the spatial reference, such as the x,y-, z-, or m-domain, resolution, or tolerance, use the Environments dialog box.

If a spatial reference is not provided, the output will have an undefined spatial reference.

Note:

The spatial reference of the Template Feature Class has no effect on the output spatial reference. If you want your output to be in the coordinate system of the Template Feature Class, set the Coordinate System parameter to the spatial reference of the Template Feature Class.

Spatial Reference
Configuration Keyword
(Optional)

The configuration keyword applies to enterprise geodatabase data only. It determines the storage parameters of the database table.

String
Output Spatial Grid 1
(Optional)

This parameter has been deprecated in AllSource. Any value you enter is ignored.

Double
Output Spatial Grid 2
(Optional)

This parameter has been deprecated in AllSource. Any value you enter is ignored.

Double
Output Spatial Grid 3
(Optional)

This parameter has been deprecated in AllSource. Any value you enter is ignored.

Double
Feature Class Alias
(Optional)

The alternate name for the output feature class that will be created.

String

Derived Output

LabelExplanationData Type
Output Feature Class

The new feature class.

Feature Class

arcpy.management.CreateFeatureclass(out_path, out_name, {geometry_type}, {template}, {has_m}, {has_z}, {spatial_reference}, {config_keyword}, {spatial_grid_1}, {spatial_grid_2}, {spatial_grid_3}, {out_alias})
NameExplanationData Type
out_path

The enterprise or file geodatabase or the folder in which the output feature class will be created. This workspace must already exist.

Workspace; Feature Dataset
out_name

The name of the feature class to be created.

String
geometry_type
(Optional)

Specifies the geometry type of the output feature class.

  • POINTThe geometry type will be point.
  • MULTIPOINTThe geometry type will be multipoint.
  • POLYGONThe geometry type will be polygon.
  • POLYLINEThe geometry type will be polyline.
  • MULTIPATCHThe geometry type will be multipatch.
String
template
[template,...]
(Optional)

The feature class or table used as a template to define the attribute fields of the new feature class.

Table View
has_m
(Optional)

Specifies whether the feature class will have linear measurement values (m-values).

  • DISABLEDThe output feature class will not have m-values. This is the default.
  • ENABLEDThe output feature class will have m-values.
  • SAME_AS_TEMPLATEThe output feature class will have m-values if the dataset specified in the Template Feature Class parameter (template parameter in Python) has m-values.
String
has_z
(Optional)

Specifies whether the feature class will have elevation values (z-values).

  • DISABLEDThe output feature class will not have z-values. This is the default.
  • ENABLEDThe output feature class will have z-values.
  • SAME_AS_TEMPLATEThe output feature class will have z-values if the dataset specified in the Template Feature Class parameter (template parameter in Python) has z-values.
String
spatial_reference
(Optional)

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

  • Enter the path to a .prj file, such as C:/workspace/watershed.prj.
  • Reference a feature class or feature dataset whose spatial reference you want to apply, such as C:/workspace/myproject.gdb/landuse/grassland.
  • Define 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.

If a spatial reference is not provided, the output will have an undefined spatial reference.

Note:

The spatial reference of the Template Feature Class has no effect on the output spatial reference. If you want your output to be in the coordinate system of the Template Feature Class, set the Coordinate System parameter to the spatial reference of the Template Feature Class.

Spatial Reference
config_keyword
(Optional)

The configuration keyword applies to enterprise geodatabase data only. It determines the storage parameters of the database table.

String
spatial_grid_1
(Optional)

This parameter has been deprecated in AllSource. Any value you enter is ignored.

Double
spatial_grid_2
(Optional)

This parameter has been deprecated in AllSource. Any value you enter is ignored.

Double
spatial_grid_3
(Optional)

This parameter has been deprecated in AllSource. Any value you enter is ignored.

Double
out_alias
(Optional)

The alternate name for the output feature class that will be created.

String

Derived Output

NameExplanationData Type
out_feature_class

The new feature class.

Feature Class

Code sample

CreateFeatureclass example (Python window)

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

import arcpy
arcpy.env.workspace = "C:/data"
arcpy.management.CreateFeatureclass("C:/output", "habitatareas.shp", "POLYGON", 
                                    "study_quads.shp", "DISABLED", "DISABLED", 
                                    "C:/workspace/landuse.shp")
CreateFeatureclass example 2 (stand-alone script)

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

# Name: CreateFeatureclass_Example2.py
# Description: Create a feature class to store the gnatcatcher habitat zones

# Import system modules
import arcpy

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

# Set local variables
out_path = "C:/output"
out_name = "habitatareas.shp"
geometry_type = "POLYGON"
template = "study_quads.shp"
has_m = "DISABLED"
has_z = "DISABLED"

# Use Describe to get a SpatialReference object
spatial_ref = arcpy.Describe("C:/workspace/studyarea.shp").spatialReference

# Run CreateFeatureclass
arcpy.management.CreateFeatureclass(out_path, out_name, geometry_type, template, 
                                    has_m, has_z, spatial_ref)