I thought that I might have fixed it for a moment. You can put either a point or a PointGeometry into into the queryPointAndDistance(in_point) according to PointGeometry—ArcPy Classes | ArcGIS Desktop. However, when I create either one, it gives the ValueError message for my point/PointGeometry.
cursorResult = arcpy.da.SearchCursor('PairedCheck6','SHAPE@TRUECENTROID').next()[0]
centroid = None
if len(cursorResult) > 0:
centroid = cursorResult
ptg = arcpy.Point(*centroid)
else:
return '5000'
(pointGeometry, distance, minDistance, isCentroidRight) = shape.queryPointAndDistance( ptg, False)
Traceback (most recent call last): File "<expression>", line 1, in <module> File "<string>", line 23, in Strike ValueError: <Point (612744.990605, 3417217.99738, #, #)> Failed to execute (CalculateField).
This is the entire error code, although I think that the above is the important part.
Runtime error Traceback (most recent call last): File "<string>", line 49, in <module> File "c:\program files (x86)\arcgis\desktop10.4\arcpy\arcpy\management.py", line 3360, in CalculateField raise e ExecuteError: ERROR 000539: Error running expression: Strike( GPVARIANTOBJECT0, 124, 1 ) Traceback (most recent call last): File "<expression>", line 1, in <module> File "<string>", line 23, in Strike ValueError: <Point (612744.990605, 3417217.99738, #, #)> Failed to execute (CalculateField).
cursorResult = arcpy.da.SearchCursor('PairedCheck6','SHAPE@TRUECENTROID').next()[0]
centroid = None
if len(cursorResult) > 0:
centroid = cursorResult
inTable =
spatialRef = arcpy.Describe(inTable).spatialReference
ptg = arcpy.PointGeometry(arcpy.Point(*centroid), spatialRef)
else:
return '5000'
(pointGeometry, distance, minDistance, isCentroidRight) = shape.queryPointAndDistance( ptg, False)
Traceback (most recent call last): File "<expression>", line 1, in <module> File "<string>", line 26, in Strike ValueError: <PointGeometry object at 0xedb99b0[0xedb9140]> Failed to execute (CalculateField).
I am wondering if there is something wrong with the original spatial reference of my data, as when I had originally found the reference by describing my feature class.
inTable =
spatialRef = arcpy.Describe(inTable).spatialReference
print spatialRef.name
However, this might be getting beyond the scope of my original question as it is no longer about how to make my input a Point, but why my input point does not work.