-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCreateErrorPts.py
33 lines (25 loc) · 973 Bytes
/
CreateErrorPts.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import arcpy
import os
def createErrorPts(dict, outLocation, outFile, fldName, countySrcPts):
def removeNone(word):
if word == None:
word = ''
return word
arcpy.env.workspace = outLocation
arcpy.env.overwriteOutput = True
shp_fullPath = os.path.join(outLocation, outFile)
proj = arcpy.Describe(countySrcPts).SpatialReference
arcpy.CreateFeatureclass_management(outLocation, outFile, 'POINT', '', '', '', proj)
print ('Created ' + shp_fullPath)
arcpy.AddField_management(shp_fullPath, fldName, 'TEXT')
arcpy.AddField_management(shp_fullPath, 'NOTES', 'TEXT')
arcpy.DeleteField_management(shp_fullPath, 'Id')
errorFlds = [fldName, 'NOTES', 'SHAPE@']
iCursor = arcpy.da.InsertCursor(shp_fullPath, errorFlds)
for d in dict:
inFld = removeNone(d)
notes = dict[d][0]
shp = dict[d][1]
iCursor.insertRow((inFld, notes, shp))
del iCursor
return errorFlds