0

I get this error when I run my script:

Runtime error Traceback (most recent call last): File "", line 15, in AttributeError: 'module' object has no attribute 'XYTableToPoint'

Script:

import arcpy

arcpy.env.overwriteOutput = True
from arcpy import env
env.workspace = r'U:\skelley\Python\Outputs'
inTable = r'U:\skelley\Python\FWD_GPR_import\FWD_Halsey_WGS1984.csv'
arcpy.management.XYTableToPoint(inTable, "quasars", "lat", "long", 
arcpy.SpatialReference(4326))

Can anybody tell me why?

  • 1
    What version of ArcGIS are you using? I'm guessing you're in 10.x and using a Pro tool based on Google search. The similar tool for Desktop is Make XY Event Layer. – smiller Oct 24 '18 at 20:31
  • Using Desktop Advanced - documentation says that this tool is available with this license. We've used it manually before; I'm just trying to simplify a process by writing some code. – SarahKelley Oct 24 '18 at 20:35
  • Could you please post a link to that doc? I haven't found it in my search. – smiller Oct 24 '18 at 20:35
  • This is a tool that is available in ArcGIS Pro -- at check the URL of the website. As a workaround, use the Desktop geoprocessing tool called Make XY Event Layer. – smiller Oct 24 '18 at 20:38
2

Similar to Why is Python Script (using XYTabletoPoint) Deleting target Feature Class?:

XY Table To Point is a tool available in ArcGIS Pro. A search online for "XY Table To Point arcpy 10.3" does not return any documentation for 10.x, but does return a different tool, Make XY Event Layer. Note when using the Desktop tool Make XY Event Layer that it creates a layer, not a point feature class or shapefile. To save the output after the event layer is created, use arcpy.management.CopyFeatures

Be careful with latlong and this tool. Remember X should map to longitude, and Y to latitude, so code is for example :

arcpy.MakeXYEventLayer_management(in_Table, "longitude" , "latitude",
    out_Layer, spRef, z_coords)

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.