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(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})
Parameter | Explanation | Data 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.
| 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).
| String |
has_z (Optional) | Determines if the feature class contains elevation values (z-values).
| String |
spatial_reference (Optional) |
The spatial reference of the output feature dataset. You can specify the spatial reference in the following ways:
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 |
Derived Output
Name | Explanation | Data Type |
out_feature_class | The new feature class. | Feature Class |
Code sample
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")
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
# Execute CreateFeatureclass
arcpy.CreateFeatureclass_management(out_path, out_name, geometry_type, template,
has_m, has_z, spatial_ref)
Environments
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes