Database Reference
In-Depth Information
Creating a feature class
Python has helped us create a geodatabase; however, this geodatabase is empty, and we
need more tools to help us populate it. For this, we will introduce the new ar-
cpy.CreateFeatureclass_management command, which takes a minimum of
three parameters: the full path of the geodatabase you want to create the feature class in,
the name of the feature class, and the geometry type. To create a feature class, perform the
following steps:
1. Open a new Python editor session and type the following lines of code:
import arcpy
sgdb_fullpath="c:/gdb/my_Python_gdb.gdb"
sfc_name = "my_Python_featureclass"
sgeometry = "POLYGON"
arcpy.CreateFeatureclass_management(sgdb_fullpath,sfc_name,sgeometry)
input ("Feature class created successfully, press any
key to continue...")
2. Save the file as create_fc.py under the scripts folder and then run it.
3. Right-click on the geodatabase and click on Refresh . You should see your feature
class created as well in the same geodatabase, as shown in the following screen-
shot:
4. Close ArcCatalog .
Search WWH ::




Custom Search