change numeric field values into negative

المشرف العام

Administrator
طاقم الإدارة
I would like to change one field values into negative (i.e. original column, row 1 = 5, new column row 1 = -5 in a feature class list.

I got until the addfield and calculate field mngmt functions, but it is not clear how to the the negative transformation.

ARCGIS' help page has some instructions about negative expressions http://resources.arcgis.com/EN/HELP.../Calculate_Field_examples/00170000004s000000/

-x, negative expression of x, x = 5 --> -x, -5

but how to use it with arcpy is not very clear. It seems that an expression should be added either at the '!original_value!' or as a code block after the expression type (python 9.3).

for fc in arcpy.ListFeatureClasses(): #output = path.join(outWS, fc) #"GEODESIC" calculates distances in meters! #arcpy.analysis.Near(fc, idFeat, "", "NO_LOCATION", "NO_ANGLE","GEODESIC") arcpy.AddField_management(fc, 'location_value', "FLOAT") arcpy.CalculateField_management(fc, 'location_value', '!original_value!', "PYTHON_9.3", "")

أكثر...
 
أعلى