Database Reference
In-Depth Information
Tool
Description
Python script example
#Adding a Number_Of_Tables long field which will have the number of
tables in a given restaurant.
arcpy.AddField_management
(
"c:/gdb/bestaurants.gdb/Food_and_Drinks",
"Number_of_Tables",
"LONG"
)
#Adding a HAS_WIFI text field which will have YES or NO as a value.
This indicates whether this restaurant has Wi-Fi or not.
arcpy.AddField_management
(
"c:/gdb/bestaurants.gdb/Food_and_Drinks",
"Has_WIFI",
"TEXT"
)#Adding a CREATIONDATE field of type date, which will have the date
on which this feature has been added or when this restaurant has
been opened.
arcpy.AddField_management
(
"c:/gdb/bestaurants.gdb/Food_and_Drinks",
"CreationDate",
"DATE"
)
Adds a new field to
an existing feature
class
Add Field
#Delete the HAS_WIFI field.
arcpy.DeleteField_management
(
"c:/gdb/bestaurants.gdb/my_point_featureclass",
"Has_WIFI"
)
Deletes an existing
field from a feature
class
Delete
Field
#Copy all features in the feature class Food_and_Drinks from an
existing geodatabase to another existing geodatabase. This tool will
automatically create a new feature class.
Copies features from
one feature class to
another
Copy
Features
arcpy.CopyFeatures_management
(
"c:/gdb/bestaurants_old.gdb/Food_and_Drinks",
"c:/gdb/bestaurants_new.gdb/Food_and_Drinks"
)
#Populates the CreateDate field in the food_and_drinks feature class
with today's date.
import datetime
d = datetime.date.today()
arcpy.CalculateField_management
(
"c:/gdb/bestaurants.gdb/Food_and_Drinks",
"CreationDate",
"'" + str(d) + "'",
Fills a field with val-
ues based on a for-
mula
Calculate
Field
Search WWH ::




Custom Search