#python #ArcPy #for #syntaxerror
I am updating this tool that calculates the latitude and longitude values for all node poles. Originally the user could select Original Latitude and Longitude or Adjusted Latitude and Longitude. The selection was for one or the other. The update allows the user to select both. It utilizes #arcpy.GetParametersAsText . I created a new variable for the selection of Both, Original and Adjusted. In doing this, I created a syntax error in my conditional statement ( line 49), and I cannot figure out how to fix it. Any help on the error (or completing the tool, I imagine I have a few more errors left) would be much appreciated.
import arcpy
nodeFeatures = r'OSP Mapping Layers\Node Locations'
inTable = nodeFeatures
orig_adj = arcpy.GetParameterAsText(0)
mxd = map.MapDocument("CURRENT")
arcpy.GetParameterAsText(0) = "Original or Adjusted Lat Long"
orig_adj = arcpy.GetParameterAsText(0)
name = 'orig_adj'
displayName = "Original or Adjusted Lat Long"
datatype = 'String'
direction = 'Input'
filters[0].list = ['Original', 'Adjusted', 'Both']
filters[1].type = 'ValueList'
latField = "OriginalLatitude"
longField = "OriginalLongitude"
adlatField = "AdjustedLatitude"
adlongField = "AdjustedLongitude"
btlatField = "OriginalLatitude" + "AdjustedLatitude"
btlongField = "OriginalLongitude" + "AdjustedLongitude"
mxd = map.MapDocument("CURRENT")
arcpy.AddMessage("Are you updating the Original or Adjusted coordinates?")
arcpy.GetParameterAsText(0)
arcpy.SetParameterAsText(0,x)
x
def(x)
if:
x == "Original" = 'true'
and x == "Original" = 'true'
latField = "OriginalLatitude"
longField = "OriginalLongitude";
elif x == "Adjusted" = 'true'
and x = "Adjusted" = 'true'
adlatField = "AdjustedLatitude"
adlongField = "AdjustedLongitude";
else: x == "Both" = 'true'
btlatField == "BothLatitude"
btlongField = "BothLongitude"
arcpy.AddMessage("Calculating the latitude values for all node features...")
expression = "!Shape.Centroid.Y!"
arcpy.CalculateField_management(inTable, latField, adlatField, btlatField, expression, "PYTHON_9.3", "")
arcpy.AddMessage("The latitude values have been calculated for all node features!")
arcpy.AddMessage("...")
arcpy.AddMessage("...")
arcpy.AddMessage("Calculating the longitude values for all node features...")
expression = "!Shape.Centroid.X!"
arcpy.CalculateField_management(inTable, longField, adlongField, btlongField, expression, "PYTHON_9.3", "")
arcpy.AddMessage("The longitude values have been calculated for all node features!")
arcpy.AddMessage("...")
arcpy.AddMessage("...")