2

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.

2

"DMS" is not one of the supported coordinate formats, use "DMS_1" instead. See the help for the list of formats.

DMS_1 —Both longitude and latitude values are in a single field. Two values are separated by a space, a comma, or a slash.

For DD_1, DDM_1, and DMS_1, the latitude and longitude values required to represent a location are concatenated into a single string and stored in a single field.

  • Hi, yes you are right. I just found out that this parameter has changed from version 10 to 10.2.2. So I did the following adjustments: DMS to DMS_1 / DDM to DDM_2 and DD to DD_2. By the way now I got a different error message: Error 999999 – Dkitoko Apr 4 '16 at 4:27
  • @Dkitoko if my answer works for you then please click the tick to mark it as the answer. – user2856 Apr 4 '16 at 4:47
  • Thanks a lot @Luke, I managed to make it work putting the correct formats and changing the way that I was creating the DMS field. – Dkitoko Apr 5 '16 at 12:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.