Summary
Creates an empty feature class in an ArcSDE, file geodatabase, or personal 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. Custom feature classes such as annotation, dimensions, and relationship class are created in the Catalog window or in ArcCatalog by right-clicking a Geodatabase and selecting the New...
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})
Parameter | Explanation | Data Type |
out_path | The ArcSDE, file, or personal 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 several ways:
| Spatial Reference |
config_keyword (Optional) | The configuration keyword applies to ArcSDE data only. It determines the storage parameters of the database table. | String |
spatial_grid_1 (Optional) | The Spatial Grid 1, 2, and 3 parameters are used to compute a spatial index and only apply to file geodatabases and certain workgroup and enterprise geodatabase feature classes. If you are unfamiliar with setting grid sizes, leave these options as 0,0,0 and ArcGIS will compute optimal sizes for you. Since no features are written by this tool, the spatial index will be in an unbuilt state. The index will be built when features are written to the feature class such as by the Append tool or editing operations. For more information about this parameter, refer to the Add Spatial Index tool documentation. | Double |
spatial_grid_2 (Optional) | Cell size of the second spatial grid. Leave the size at 0 if you only want one grid. Otherwise, set the size to at least three times larger than Spatial Grid 1. | Double |
spatial_grid_3 (Optional) | Cell size of the third spatial grid. Leave the size at 0 if you only want two grids. Otherwise, set the size to at least three times larger than Spatial Grid 2. | Double |
Code sample
CreateFeatureclass Example (Python Window)
The following Python Window script demonstrates how to use the CreateFeatureclass function in immediate mode.
import arcpy
from arcpy import env
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 Python 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
from arcpy import env
# Set workspace
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)
Environments
Licensing information
- ArcGIS Desktop Basic: Yes
- ArcGIS Desktop Standard: Yes
- ArcGIS Desktop Advanced: Yes