Avg Nearest Neighbor fails when called from Python Toolbox tool

310
0
04-14-2014 09:43 AM
RyanClancy
Occasional Contributor
I'm integrating the Average Nearest Neighbor (ANN) tool into a custom Python Toolbox tool. When I run ANN from the default ArcToolbox dialog it works great. When I call the ANN tool via arcpy using the same input and parameters the tool fails; I get ERROR 000224 Cannot insert features.

The problem appears to be related to the fourth parameter, called "Area". I want to use the default, so I pass "#" as the fourth parameter like so:

arcpy.AverageNearestNeighbor_stats("burglaries", "EUCLIDEAN_DISTANCE", "NO_REPORT", "#")


...and the tool fails. But when I change the fourth parameter to some arbitrary number like so:

arcpy.AverageNearestNeighbor_stats("burglaries", "EUCLIDEAN_DISTANCE", "NO_REPORT", 50)

...it works. Any ideas on why this is happening? In both cases the input is a Query Layer. As I said, the default works just fine with the exact same data when I run the Average Nearest Neighbor tool on its own.
0 Kudos
0 Replies