POST
|
Yes, I need to do an manual selection inside arcmap and only populate one field of that selected feature, not of all the features in that one field. Thank you for your help though.
... View more
06-08-2011
05:32 AM
|
0
|
0
|
600
|
POST
|
Here is my whole code with comments on each line import arcgisscripting, sys gp = arcgisscripting.create(9.3) ##a = input ("Enter Manhole Elevation: ") ##c = (a - 1.7) ##b = input ("Enter Inv Out: ") ##z = (a - b) ##print "Manhole Elevation is: " ,c ##print "Interior Drop is: " ,z ManholeElevation = sys.argv[1] InvertOut = sys.argv[2] gp.workspace = #this is not complete b/c it will be a file GDB (I need the server name etc) try: x = (ManholeElevation - 1.7) #math function y = (ManholeElevation - InvertOut) #math function print "Creating lyr.. " gp.MakeFeatureLayer_management("manhole", "lyr") #create temp lyr from manhole fetaure class with selected features print "Selecting..." gp.SelectLayerByAttribute_management("lyr", "New_Selection", "Elevation") #select the feature in that temporary layer??? print "Calculating..." gp.CalculateField_management("manhole","Elevation", x) # in the manhole feature class, under the field name Elevation populate the selected feature with the sum of variable x "Manhole elevation calculated..." #gp.CalculateField_management("Manhole","InteriorDrop", y) # in the manhole feature class, under the Elevation field populate the sum of variable y . except: #If an error occurred while running a tool, then print the messages print gp.GetMessages() any help will be appreciated, thanks.
... View more
06-07-2011
05:48 PM
|
0
|
0
|
600
|
POST
|
Hey Logan, This was the demo tool I used to see if it would update a single field within an attribute table.... the result was all the features in the specified field had the number 23....... Sorry I will give you my whole code when I return import arcgisscripting, sys gp = arcgisscripting.create(9.3) #ManholeElevation = sys.argv[1] gp.workspace = "Q:/63_Projects/State/SC/SC_DNR_2010/Hampton/ANALYSIS/DATA/SHP/LiDAR_QA" #x = (ManholeElevation - 1.7) gp.CalculateField_management("05_11_2011_3.shp","Altitude", "23") # If an error occurred while running a tool, then print the messages #print gp.GetMessages()
... View more
06-07-2011
03:50 PM
|
0
|
0
|
600
|
POST
|
Thanks for the idea, I tried this first thinking it woukd recognize the skeceted feature but it didnt, it just updated every feature in the specified field inside the feature class... It did not recognize the seleceted feature.. I tried this on a dummy shapefile and not on my actuak database bc i dont want to risk compromising the data... Any other options or ideas?? Thanks!
... View more
06-07-2011
02:16 PM
|
0
|
0
|
600
|
POST
|
Here is what I have added. I see what you are getting me to do but in the I am getting the error in select by attributes. I intend to select a single point feature, run this script by entering an elevation and click enter and have this script do the math and update the answers into the attribute table. It should only update one field. I think in the selectlayerbyattribute there is no option for continue with current selection as I dont want to create a new selection I just want to update a field from a feature that I have already selected. import arcgisscripting, sys gp = arcgisscripting.create(9.3) print "Creating lyr.. " gp.MakeFeatureLayer_management("stations.shp", "lyr") print "Selecting..." gp.SelectLayerByAttribute_management("lyr", "New_Selection","ANN_PREC") print "Calculating..." gp.CalculateField_management("stations.shp","ANN_PREC", x) #print "Manhole elevation calculated..." #gp.CalculateField_management("Manhole","InteriorDrop", y) thanks for your help! Tom
... View more
06-07-2011
12:49 PM
|
0
|
0
|
600
|
POST
|
Hello, I am trying to write a python script that will populate an attribute field of a selected feature. I see that it is possible with select features by location by.. Use makefeaturelayer. Feed the feature layer into the selectbylocation. then use calculate field. However I am selecting one point feature at a time and I am only trying to update one field with my script.. I thought the right tool was the script below but it updates every feature in that field instead of the selected feature. (Manhole is the feature class, Elevation is the field name, x is the sum of a mathematical function from another part of the code.) gp.CalculateField_management("Manhole","Elevation", "x") Any help will be appreciated. Thanks, Tom
... View more
06-07-2011
09:46 AM
|
0
|
9
|
1239
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|