Skip To Content

Create Feature Class

Summary

Creates an empty feature class in an enterprise or file geodatabase; in a folder, it creates a shapefile.

Usage

  • The Feature Class Location (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 a field named ID of type integer. The ID field is not created when you provide a Template Feature Class.

Syntax

CreateFeatureclass_management (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})
ParameterExplanationData 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)

The geometry type of the feature class.

  • POINTPoint
  • MULTIPATCHMultipatch
  • MULTIPOINTMultipoint
  • POLYGONPolygon
  • POLYLINEPolyline
String
template
[template,...]
(Optional)

The feature class used as a template to define the attribute schema of the feature class.

Feature Layer
has_m
(Optional)

Determines if the feature class contains 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)

Determines if the feature class contains 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 theTemplate 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 ArcGIS Pro. Any value you enter is ignored.

Double
spatial_grid_2
(Optional)

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

Double
spatial_grid_3
(Optional)

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

Double
out_alias
(Optional)

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

String

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.CreateFeatureclass_management("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_reference = arcpy.Describe("C:/workspace/studyarea.shp").spatialReference

# Execute CreateFeatureclass
arcpy.CreateFeatureclass_management(out_path, out_name, geometry_type, template, has_m, has_z, spatial_reference)

Licensing information

  • ArcGIS Desktop Basic: Yes
  • ArcGIS Desktop Standard: Yes
  • ArcGIS Desktop Advanced: Yes

Related topics