XYTableToPoint not working - no results

2692
18
Jump to solution
05-03-2021 11:44 PM
Labels (1)
JinseoYoon
New Contributor III

Hi,

I am using Arcgis pro notebook for geocoding XY coordinations. While I can do it with "Display XY data" function (by right clicking the layer in the content panel), I cannot do it with a very simple code in the notebook. 

The code and output are copied here. 

Nothing has been created, either the table or the point shape file. 

Can anyone help? Thank you very much in advance. 

------ code --------- 

 arcpy.env.workspace = r"c:\WORK\GIS\OUTPUT.gdb"

# Set the local variables

in_folder = r"c:\WORK\GIS\PED_MOVE\flow_age_ymd_202006_sample.csv"

x_coords = "X_COORD"

y_coords = "Y_COORD"

z_coords = ""

out_fc = "flow_age_ymd_202006_sample"

arcpy.management.XYTableToPoint(in_folder, out_fc, x_coords, y_coords, z_coords, arcpy.SpatialReference("Korea Geodetic Datum 2000"))

----------------

Output

c:\WORK\GIS\OUTPUT.gdb\flow_age_ymd_202006_sample

Messages

Start Time: XXX
WARNING 100160: Some of the features have invalid geometry and have been removed from the result
WARNING 000192: Invalid value for rows: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49
Succeeded at XXX (Elapsed Time: 1.79 seconds)

0 Kudos
1 Solution

Accepted Solutions
DanPatterson
MVP Esteemed Contributor

The coordinates are in a projected coordinate system.

I had to use another one for Korea, so the results may not be correct. 

Yours isn't listed in the available projected coordinates for Korea.

Here is what I got with what I used.

Back to you to figure out what to use, to make the error go away.

korea.png


... sort of retired...

View solution in original post

18 Replies
DanPatterson
MVP Esteemed Contributor

Drop the z values a "" is not a valid value for a z coordinate


... sort of retired...
JinseoYoon
New Contributor III

Dear DanPatterson, 

Thanks a lot for your suggestion!! 

I've tried to remove the z_coord specification (z_coords = ""), and modified the function as below. 

arcpy.management.XYTableToPoint(in_folder, out_fc, x_coords, y_coords, arcpy.SpatialReference("Korea Geodetic Datum 2000")) 

but it does not work,, the message that I've got was as below. 

ExecuteError: ERROR 000622: Failed to execute (XY Table To Point). Parameters are not valid.
ERROR 000623: Invalid value type for parameter z_field.

 Would you please advise? 

0 Kudos
DanPatterson
MVP Esteemed Contributor

XY Table To Point (Data Management)—ArcGIS Pro | Documentation

These are the parameters in order, you haven't provided a proper output_feature_class name and you just done drop a parameter you should use named parameters rather than relying positional parameters

arcpy.management.XYTableToPoint(in_table, out_feature_class, x_field, y_field, {z_field}, {coordinate_system})

arcpy.management.XYTableToPoint(
     in_table =  ?,
     out_feature_class = ?,
     x_field = ?,
     y_field = ?,
     coordinate_system = ?)

  


... sort of retired...
JinseoYoon
New Contributor III

Thank you again for your advice.

Indeed I've done everything that you have suggested. 

 

 

in_table = r"D:\XXX\XXX.csv"

x_field = "X_COORD"

y_field = "Y_COORD"

out_feature_class = "flow_age_sample"

arcpy.management.XYTableToPoint(in_table, out_feature_class, x_field, y_field, arcpy.SpatialReference("Korea Geodetic Datum 2000"))

 

the z-field seems optional, but it seems still needed. Would you advise one more time? Thank you very much for your patients. 

ExecuteError: ERROR 000622: Failed to execute (XY Table To Point). Parameters are not valid.
ERROR 000623: Invalid value type for parameter z_field

 

0 Kudos
DavidPike
MVP Frequent Contributor

Maybe try arcpy.SpatialReference(4737)

JinseoYoon
New Contributor III

Thank you very much, but it seems the problem occurred due to the z-field specification. 

I do not have a z-value field and the function still needs one. 

 

ExecuteError: ERROR 000622: Failed to execute (XY Table To Point). Parameters are not valid.
ERROR 000623: Invalid value type for parameter z_field.

 

0 Kudos
DanPatterson
MVP Esteemed Contributor
tbl = r"D:\XXX\XXX.csv"
x_fld = "X_COORD"
y_fld= "Y_COORD"
out_fc = "flow_age_sample"
coord = arcpy.SpatialReference("Korea Geodetic Datum 2000")

arcpy.management.XYTableToPoint(
     in_table=tbl,
     out_feature_class=out_fc,
     x_field=x_fld,
     y_field=y_fld,
     coordinate_system=coord)

 

They were invalid because you dropped a position argument.  Use named arguments to guarantee they are correct and have values, or provide an appropriate null value for ones you are skipping


... sort of retired...
JinseoYoon
New Contributor III

Thank you very much, but it still does not work. I followed your suggestion and the results are the same. The position argument dos not seem necessary, and the z-value can be just omitted since it is only an optional. 

0 Kudos
JinseoYoon
New Contributor III

arcpy.management.XYTableToPoint(
in_table = in_folder,
out_feature_class = out_fc,
x_field = x_coords,
y_field = y_coords,
coordinate_system = coord)

0 Kudos