Select to view content in your preferred language

Error script at point feature

809
2
05-05-2010 07:09 PM
alifardy
Emerging Contributor
i want to create point feature class... but there is an error when this script ran at arcmap 9.3.. (error 999999 : error executing function. A localator with this name does not exist)...

please, everybody help me to solve this problems...


the script has been attached below :


# import native module
import os, sys, string, arcgisscripting

# create the geoprocessor object
gp = arcgisscripting.create(9.3)
gp.OverWriteOutput = 1

# input file
InputFC = gp.GetParameterAsText(0)
pHField = gp.GetParameterAsText(1)
Discharge = gp.GetParameterAsText(2)
OutputFC = gp.GetParameterAsText(3)

# Load required toolboxes...
gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx")

# create a spatial reference object
spatialRef = gp.CreateObject("SpatialReference")

# use a projection file to define the spatial reference's properties
spatialRef.createFromFile("C:/Program Files/ArcGIS/Coordinate Systems/" + \
                            "Projected Coordinate Systems/UTM/WGS 1984/WGS 1984 UTM Zone 51N.prj")

# Process field values
drows = gp.SearchCursor(InputFC,"",None,Discharge)
drow = drows.next()

dvalue = []
while drow:
    dval = drow.GetValue(Discharge)
    dvalue.append(dval)
    drow = drows.next()

del drows
sum2 = sum (dvalue)

prows = gp.SearchCursor(InputFC,"",None,pHField)
prow = prows.next()

pvalue = []
while prow:
    pval = prow.GetValue(pHField)
    pvalue.append(pval)
    prow = prows.next()

del prows  
sum1 = sum (pvalue*dvalue for pvalue,dvalue in zip (pvalue,dvalue))

countfinal = sum1/sum2
       
outrows = gp.InsertCursor(OutputFC)

# create point object to create feature
pnt = gp.CreateObject("Point")
pnt.id = 1
pnt.x = 566020
pnt.y = 252044

# create the output feature class using the spatial reference object
gp.CreateFeatureClass(os.path.dirname(OutputFC),os.path.basename(OutputFC),"Point",spatialRef)
gp.AddField_management(OutputFC,"Debit","FLOAT")
gp.AddField_management(OutputFC,"pH","FLOAT")

inrow = outrows.NewRow()
inrow.shape = pnt
inrow.SetValue("Debit",sum2)
inrow.SetValue("pH",countfinal)
outrows.InsertRow(inrow)
   
del outrows
0 Kudos
2 Replies
GerryGabrisch
Frequent Contributor
At the very least, the lines under your while statements need to be indented.
0 Kudos
alifardy
Emerging Contributor
it's because i didn't know how to indent the script in this post. but i have done that  when run the script in arcgis.
0 Kudos