I am trying to create a custom tool that take x,y coordinates, buffers them and then puts them into a new feature class. Whenever I try to run the tool I get:
ERROR000732 Input Features: Dataset (x, y coordinates) does not exist or is not supported
Here is my script:
import arcpy
import os
point = arcpy.GetParameterAsText(0)
outputFC = arcpy.GetParameterAsText(1)
buffDist = arcpy.GetParameterAsText(2)
arcpy.Buffer_analysis(point, outputFC, buffDist)
Here is the error from the tool after the script is run:
2 Answers 2
According to its help page, the Buffer
operation requires a feature layer input. When an ArcPy error includes "does not exist or is not supported", and you're sure* the input exists, the remaining option is that it isn't the right type of input. In this case, you can't just pass two numbers -- Buffer
was not programmed to be able to handle that.
You're going to need more code in your Python script to turn the point (x, y) into a Point geometry type, and possibly also turn it into a feature layer. I mentioned that in another answer, here (the bit about arcpy.Point
).
* Being sure the input exists should include debugging with print(point)
or arcpy.AddMessage(point)
so your script shows you what it thinks the value of point
is. Sometimes it's totally valid, sometimes it's not, and eliminating the easy possibilities saves time.
When you use GetParameterAsText
, it is literally a string. The input to arcpy.Buffer_analysis requires, in your case, a Point. By converting the string input to a Point object, you should be able to get the tool to run:
point2 = point.split(" ")
point3 = arcpy.Point(float(point2[0]),float(point2[1]))
arcpy.Buffer_analysis(point3, outputFC, buffDist)
Now that I think of it, a quicker way would be to just use GetParameter
instead of GetParameterAsText
. This will leave your point input as a Point object.
"
and{}
buttons that enables you to format any highlighted text nicely.