ExecuteError: Failed to execute. Parameters are not valid. ERROR 000735: Y Field (Latitude): Value is required Failed to execute (ConvertCoordinateNotation).

12389
5
Jump to solution
04-02-2016 11:11 AM
DilsonKitoko
New Contributor III

Hi,

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 54 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. I can share my toolbox if needed.

Thanks in advance

Dilson

0 Kudos
1 Solution

Accepted Solutions
NeilAyres
MVP Alum

Have a closer look at the help for the Convert Coordinate Notation tool.

If you are suppling the input Lat/Long in 2 separate fields, I believe the input format should be "DD_2"

View solution in original post

5 Replies
NeilAyres
MVP Alum

Have a closer look at the help for the Convert Coordinate Notation tool.

If you are suppling the input Lat/Long in 2 separate fields, I believe the input format should be "DD_2"

DilsonKitoko
New Contributor III

Hi Neil,

Thanks for you reply. Yes, you are right, I just found out the this parameter has changed from 10 to 10.2.2.

So I've did thee following changes in the code:

DDM to DDM_2

DMS to DMS_1

DD to DD_2.

But I still getting a error message message : Convert Coordinate Notation (Data Management) Tool Error 999999.

0 Kudos
RebeccaStrauch__GISP
MVP Emeritus

Dilson, you didn't show you current version after splitting the x and y into separate fields for the command, but this is what works for me (notice, I removed the last two arguments, as I did not need them)

# to decimal degrees with N/S/E/W designation at end (vs. ptdd_ versions above that have W/S as negative)
arcpy.ConvertCoordinateNotation_management(randomPtSetdd, finaltmp1X, "POINT_X", "POINT_Y", "DD_2", "DD_2") #, "", geoSR )  

# to degree-decimal minutes
arcpy.ConvertCoordinateNotation_management(finaltmp1X, finaltmp2X, "POINT_X", "POINT_Y", "DD_2", "DDM_2") #, "", geoSR )  

# to degree-minutes-seconds
arcpy.ConvertCoordinateNotation_management(finaltmp2X, finalOutdd, "POINT_X", "POINT_Y", "DD_2", "DMS_2") #, "", geoSR) 

My data was coming from another projected cord system, so before I ran the above, I added the XY

arcpy.AddXY_management(randomPtSetdd)
arcpy.CalculateField_management(randomPtSetdd, "ptdd_long", "!POINT_X!", "PYTHON_9.3", "")
arcpy.CalculateField_management(randomPtSetdd, "ptdd_lat", "!POINT_Y!", "PYTHON_9.3", "")
DilsonKitoko
New Contributor III

Hi Rebecca,

Thanks for your answer, I've managed to make it work putting the correct formats and changing the way that I was creating the DMS field.

You are right regarding the current version. By the way, in my code it's there as a string "coordinateformat" . It's working now, even on ArcGIS Server.

@Neil Ayres Thanks!

0 Kudos
RebeccaStrauch__GISP
MVP Emeritus

Glad you got it to work.  Just a heads up, if you are starting in a different projection and then the the ConvertCoordinateNotation, if found an issue with using this...adding my fields...then projecting back to the original projection.  The coords had shifted.  To bug reports were create

BUG-000092962 : Convert Coordinate Notation tool does not apply the specified Geographic Transformation from the Environments > Output Coordinates setting.

BUG-000092945 : Convert Coordinate Notation tool truncates decimal degree values to 4 or 5 decimal places. This results in data that is 2 1/2 meter away from the original data.

and looks like they are both  fixed for the next release

For this particular project, the 2.5 meters was not critical, but keep that in mind if you your is.  My fix, to help some, was to re-project it to geographic first, then run the ConvertCoorinateNotation.    That helped.