I've a python code which was working in ArcGIS 10, but now since I've migrated to 10.2.2 didn't work.Basically it's a toolset which runs a python script. The tool allow the user to input coordinates in DMS or DDM, create the points and after track the path.Here is my error message:
Traceback (most recent call last):
File "C:\GP_TOOLS\VesselTrack.py", line 54, in <module>
arcpy.ConvertCoordinateNotation_management(TableTemp, output_Vessel, "LATLONG","", coordinateformat, "DD")
File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\management.py", line 7652, in ConvertCoordinateNotation
raise e
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000735: Y Field (Latitude): Value is required
Failed to execute (ConvertCoordinateNotation).
Failed to execute (VesselTrack).
The following is the code:
#import arcgisscripting
import arcpy, os
from math import radians, sin, cos
from arcpy import env
# get the input & output parameters
latitude = str(arcpy.GetParameterAsText(0))
longitude = str(arcpy.GetParameterAsText(1))
coordinateformat = arcpy.GetParameterAsText(2)
description = str(arcpy.GetParameterAsText(3))
link1 = str(arcpy.GetParameterAsText(4))
link2 = str(arcpy.GetParameterAsText(5))
delhistory = str(arcpy.GetParameterAsText(6))
output_Vessel = arcpy.GetParameterAsText(7)
output_Track = arcpy.GetParameterAsText(8)
# Create table
TablePath, outFC = os.path.split(output_Vessel)
TableName = "TableTemp"
TableTemp = os.path.join(TablePath, TableName)
arcpy.CreateTable_management(TablePath, TableName)
if str(coordinateformat) == "DDM" :
arcpy.AddField_management(TableTemp, "LAT", "TEXT", "", "", 50)
arcpy.AddField_management(TableTemp, "LON", "TEXT", "", "", 50)
rows = arcpy.InsertCursor(TableTemp)
row = rows.newRow()
row.setValue("LAT", latitude)
row.setValue("LON", longitude)
rows.insertRow(row)
del row
del rows
# Convert coordinates and create FC
arcpy.ConvertCoordinateNotation_management(Table, output_Vessel, "LON", "LAT", coordinateformat, "DD")
if str(coordinateformat) == "DMS" :
arcpy.AddField_management(TableTemp, "LATLONG", "TEXT", "", "", 50)
rows = arcpy.InsertCursor(TableTemp)
row = rows.newRow()
row.setValue("LATLONG", latitude + " " + longitude)
rows.insertRow(row)
del row
del rows
# Convert Coordinate Notation
arcpy.ConvertCoordinateNotation_management(TableTemp, output_Vessel, "LATLONG","", coordinateformat, "DD")
# Add the attributes to the Point FC
arcpy.AddField_management(output_Vessel, "DESCR", "TEXT", "", "", 5000)
arcpy.AddField_management(output_Vessel, "LINK1", "TEXT", "", "", 255)
arcpy.AddField_management(output_Vessel, "LINK2", "TEXT", "", "", 255)
arcpy.CalculateField_management(output_Vessel, "DESCR", '"' + description + '"', "PYTHON_9.3")
arcpy.CalculateField_management(output_Vessel, "LINK1", '"' + link1 + '"', "PYTHON_9.3")
arcpy.CalculateField_management(output_Vessel, "LINK2", '"' + link2 + '"', "PYTHON_9.3")
# Keep the history (or remove if indicated)
vessel_history = "//servername/data/Geoprocessing/TEST/GP_TOOLS_Vessel_Tracking/GP_Output.gdb/Output"
if delhistory == 'true':
arcpy.DeleteFeatures_management(vessel_history)
arcpy.Append_management(output_Vessel, vessel_history, "NO_TEST")
arcpy.Delete_management(output_Vessel)
arcpy.Copy_management(vessel_history, output_Vessel)
# Create line track
Empty_Track = "//servername/data/Geoprocessing/TEST/GP_TOOLS_Vessel_Tracking/GP_Output.gdb/Empty_Track"
if delhistory == 'true':
arcpy.Copy_management(Empty_Track, output_Track)
arcpy.PointsToLine_management(output_Vessel, output_Track)
# Delete temp files
arcpy.Delete_management(Table)
This line is blocking the process: arcpy.ConvertCoordinateNotation_management(TableTemp, output_Vessel, "LATLONG","", coordinateformat, "DD")
Can anyone highlight me if I missing something... Seems like he is no getting one of the parameters to create the feature class with the points. I want it to works on ArcGIS Desktop, so I can publish it and create a geoprocessing widget in flex viewer later.