POST
|
Of course, as soon as I post my question I find the answers. parameters[1].enabled = 0
... View more
06-29-2012
07:02 AM
|
0
|
0
|
511
|
POST
|
I???m creating a tool with the new to 10.1 Python toolbox. I???ve reviewed the help but do not see how to disable an input parameter field. Input parameter[0] is a feature class. I have code in the updateParamaters definition to identify what shapeType it is. That portion works What I would like to do is to disable the input parameter[1] field based on parameter[0]. Basically if it is a point feature class, I want the next input field to go gray and not allow an input. Anyone have suggestions or a link? Thank you Alan
... View more
06-29-2012
06:50 AM
|
0
|
1
|
2499
|
POST
|
I believe you need to add your database as a data store. Alan
... View more
06-28-2012
09:16 AM
|
0
|
0
|
478
|
POST
|
If the field isn't indexed and has a lot of unique variables the sort can take a while. I wouldn't think it would be in the order of 8 minutes though. The 9.3 cursors were not quite as fast if I recall. If you are reading the feature class in the update cursor instead of a layer how you are with the field calculator that can also have an impact. I figured the indexed may make a difference so I used the ObjectID field when I ran it. I'll attempt to rewrite it using arcpy and see how it turns out. Thanks for the feedback on this. Alan
... View more
06-06-2012
06:04 AM
|
0
|
0
|
327
|
POST
|
Cursors are much faster than field calculations, so performance would improve using an UpdateCursor. I have a feature class with 266,927 records which I used to test the field calculation and the UpdateCursor. The field calculation was substantially faster than the UpdateCursor. The field calculation completed in 37 seconds. The UpdateCursor took 8 minutes and 50 seconds. My code is a bit more complicated because it includes a sort order, but I wouldn�??t expect to be that much of a performance hit. If UpdateCursor is supposed to be quicker any idea where I may have slowed the process down? Field Calculation rec=0
def autoIncrement():
global rec
pStart = 1 #adjust start value, if req'd
pInterval = 1 #adjust interval value, if req'd
if (rec == 0):
rec = pStart
else:
rec = rec + pInterval
return rec My UpdateCursor code import arcgisscripting
# Create the Geoprocessor object
gp = arcgisscripting.create(9.3)
# Input Variables
inputFC = gp.GetParameterAsText(0) #Input Feature Class
inputField = gp.GetParameterAsText(1) #Field to calculate
inputStart = gp.GetParameterAsText(2) #Starting value. Default value of 1 in ArcToolbox
inputIncrement = gp.GetParameterAsText(3) #Incement value. Default value of 1 in ArcToolbox
inputSortField = gp.GetParameterAsText(4) #Field to sort by
inputSortOrder = gp.getparameterastext(5) #Sort order. Value List (Ascending, Descending) with a default value of Ascending in ArcToolbox
def sortVariable(xSortField,xSortOrder):
if xSortOrder == "Descending":
return xSortField + " D"
else:
return xSortField + " A"
# UpdateCursor
def incrementNumbers(vFC,vField,vStart,vIncrement,vFieldList,vSort):
try:
value = int(vStart)
cur = gp.UpdateCursor(vFC,"","",vFieldList,vSort)
row = cur.Next()
while row:
row.setValue(vField,value)
cur.UpdateRow(row)
row = cur.Next()
value = value + int(vIncrement)
except:
# Warning messages
print gp.AddWarning(gp.GetMessages(1))
# Error messages
print gp.AddError(gp.GetMessages(2))
print gp.AddMessage("Complete")
# Variable of fields to use in the UpdateCursor
qFieldList = inputField + "," + inputSortField
# Variable for sort to use in the UpdateCursor
qSort = sortVariable(inputSortField,inputSortOrder)
incrementNumbers(inputFC,inputField,inputStart,inputIncrement,qFieldList,qSort)
... View more
06-06-2012
04:29 AM
|
0
|
0
|
327
|
POST
|
Wow total brain lock on my part. Thanks for the help. Alan What you want is this. Not sure of the exact syntax for 9.3 might be row.SetValue(...) row.setValue(inputField,6)
... View more
06-04-2012
11:46 AM
|
0
|
0
|
190
|
POST
|
Hello All, I am working on a script with an updatecursor and running into a syntax problem???I think. My variables are hardcoded at this time, till I get it working. The feature class and field to update are variables. I think line row.inputField = 6 is where I believe I have the problem; line row.LinkID = 5 does work as LinkID is a field name. It is looking for a field by the name of inputField instead of a variable. I'm sure it is something simple. Anyone have a suggestion? Thank you for the help. Alan import arcgisscripting # Create the Geoprocessor object gp = arcgisscripting.create(9.3) # Input Variables inputFC = r"C:\GIS_Work\Temp.gdb\Subs" inputField = "LinkID" cur = gp.UpdateCursor(inputFC) row = cur.Next() while row: #row.LinkID = 5 row.inputField = 6 cur.UpdateRow(row) row = cur.Next() print "Value Added" print "UpdateCursor Works"
... View more
06-04-2012
11:31 AM
|
0
|
2
|
513
|
POST
|
Hello All, I would like to create code to calculate a field with increment numbers, similar to this code, but with an option of a sort order. I�??m thinking I could use an UpdateCursor with a sort and loop through the records, but I assume the performance would suffer vs a strait up field calculation. Another option I was considering was a SearchCursor then calling the Calculate Field geoprocess for each record. I don't think this would improve performance though. Are there any suggestions or thoughts? Thank you Alan
... View more
06-04-2012
04:58 AM
|
0
|
4
|
450
|
POST
|
Any more news on when, exactly, 10.1 is coming out? I want to get started with 10.1, but would rather install only once if it's only going to be a week or two. A month ago at the Southeast User Conference they said June 7th or 8th.
... View more
05-31-2012
08:32 AM
|
0
|
0
|
143
|
POST
|
Is Attribute Assistant a stand alone product or only availaible with the Infrastructure Network Editing template? Is there an easy way to pull out the Attribute Assistant "code" from Infrastructure Network Editing and use it in other maps? Thank you Alan
... View more
05-17-2012
10:46 AM
|
0
|
4
|
1015
|
POST
|
Hello all, Why would I install ArcSDE with 10.1? It seems I can us ArcCatalog to create an enterprise geodatabase without SDE then have all my users use direct connections. What am I missing? Thank you Alan
... View more
05-10-2012
11:01 AM
|
1
|
71
|
18838
|
POST
|
I'm looking to do something similar. The problem with the Feature Compare tool is it uses the ObjectID as the unique identifier; there is not an option to select which field contains the unique identifier. Alan
... View more
04-23-2012
07:17 AM
|
0
|
5
|
1242
|
POST
|
The code samples you both provided worked. I discovered some issues with the data iteself that didnt want to work. Thank you for the help. Alan
... View more
02-29-2012
10:05 AM
|
0
|
0
|
477
|
POST
|
Yeah I seem to have NULL values in both the HWY_Type and SHIELD_VAL fields that I think is causing the problem. I'll take a look at it again on Monday.
... View more
02-24-2012
12:18 PM
|
0
|
0
|
477
|
Title | Kudos | Posted |
---|---|---|
1 | 08-12-2013 11:04 AM | |
1 | 05-10-2012 11:01 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|