You are on page 1of 1

# Name:IsazaMGisc9307D3.

py
# Python script that creates a polygon feature class, join a point feature class
and add the aggregated results of points into the polygon feature class.
# Auhor: Margarita Isaza
# Date: 03/16/2015
import arcpy, time, os, sys, shutil
# Start Clock
clockCount0= time.clock()
#Delete directory if exist, create it if doesn'y or recreate it and copy the row
file to the newly created directory
outPath = "C:\\temp\\d3ProcDataIsazaM"
if os.path.exists(outPath):
shutil.rmtree(outPath)
os.makedirs(outPath)
# Local variables:
temp = "C:\\temp"
npCsd = "C:\\temp\\d3RawData\\d3Raw.gdb\\npCsd"
npFarm = "C:\\temp\\d3RawData\\d3Raw.gdb\\npFarm"
d3ProcDataIsazaM = "C:\\temp\\d3ProcDataIsazaM"
countyFarm = "C:\\temp\\d3ProcDataIsazaM\\d3Proc.gdb\\countyFarm"
# Process: Create Folder
arcpy.CreateFolder_management(temp, "d3ProcDataIsazaM")
# Process: Create File GDB
arcpy.CreateFileGDB_management(d3ProcDataIsazaM, "d3Proc.gdb ", "CURRENT")
# Process: Spatial Join
arcpy.SpatialJoin_analysis(npCsd, npFarm, countyFarm, "JOIN_ONE_TO_ONE", "KEEP_A
LL", "NAME \"NAME\" true true false 70 Text 0 0 ,First,#,C:\\temp\\d3RawData\\d3
Raw.gdb\\npCsd,NAME,-1,-1", "INTERSECT", "", "")
# Process: Alter Field
arcpy.AlterField_management(countyFarm, "Join_Count", "NumberOfFarms", "NumberOf
Farms")
# Process: Delete Field
arcpy.DeleteField_management(countyFarm, "TARGET_FID")
#End Clock
clockCount1= time.clock()
runningTime= clockCount1-clockCount0
#Print Clock Counting
print "Clock = ", runningTime

You might also like