ArcGIS for Desktop

  • Documentation
  • Pricing
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS for Desktop

A complete professional GIS

ArcGIS for Server

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Pricing
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

Create Feature Class

  • Summary
  • Usage
  • Syntax
  • Code sample
  • Environments
  • Licensing information

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})
ParameterExplanationData 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.

  • POINT —
  • MULTIPOINT —
  • POLYGON —
  • POLYLINE —
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).

  • DISABLED —The output feature class will not have m-values.
  • ENABLED —The output feature class will have m-values.
  • SAME_AS_TEMPLATE —The output feature class will have m-values only if the Template has m-values.
String
has_z
(Optional)

Determines if the feature class contains elevation values (z-values).

  • DISABLED —The output feature class will not have z-values.
  • ENABLED —The output feature class will have z-values.
  • SAME_AS_TEMPLATE —The output feature class will have z-values only if the Template has z-values.
String
spatial_reference
(Optional)

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.

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 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

  • Output CONFIG Keyword
  • Output XY Domain
  • XY Resolution
  • XY Tolerance
  • Geographic Transformations
  • Output Coordinate System
  • Default Output Z Value
  • Output has M values
  • M Resolution
  • M Tolerance
  • Output has Z values
  • Output Spatial Grid 1
  • Output Spatial Grid 2
  • Output Spatial Grid 3

Licensing information

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

Related topics

  • An overview of the Feature Class toolset

ArcGIS for Desktop

  • Home
  • Documentation
  • Pricing
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS for Desktop
  • ArcGIS for Server
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Insiders Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
© Copyright 2016 Environmental Systems Research Institute, Inc. | Privacy | Legal