import arcpy
class Toolbox(object):
def __init__(self):
"""Toolbox definition"""
self.label = "Tools"
self.alias = "Tools"
self.tools = [GetPointTool]
class GetPointTool(object):
def __init__(self):
"""Initialize."""
self.label = "Get me a point"
self.description = ("Returns a simple point")
self.canRunInBackground = True
def getParameterInfo(self):
"""Parameter definitions"""
arcpy_point = arcpy.Parameter(
displayName = "Arcpy point",
name = "arcpyPoint",
datatype = "Point",
# Also tried GPPoint without success
parameterType = "Derived",
direction = "Output")
json_point = arcpy.Parameter(
displayName = "JSON point",
name = "jsonPoint",
datatype = "String",
parameterType = "Derived",
direction = "Output")
return [arcpy_point, json_point]
def isLicensed(self):
"""Set whether tool is licensed to execute."""
return True
def updateParameters(self, parameters):
"""Modify the values and properties of parameters before internal
validation is performed. This method is called whenever a parameter
has been changed."""
return
def updateMessages(self, parameters):
"""Modify the messages created by internal validation for each tool
parameter. This method is called after internal validation."""
return
def execute(self, parameters, messages):
"""Run the tool"""
# setting parameter[0] to a Point doesn't do anything.
# The type ends up being None in the message (?)
point = arcpy.Point(-111, 42)
parameters[0].value = point
arcpy.AddMessage(type(parameters[0].value))
# json point succeeds cause its String
ptGeom = arcpy.PointGeometry(point)
parameters[1].value = ptGeom.JSON
arcpy.AddMessage(parameters[1].value)
returnCircumstances are slightly different, I ran into this issue when trying to set defaults in updateParameters. But I imagine the solution is the same and since this has been around since 2013 and nobody has replied I thought I would!
I'm using ArcGIS Pro and tested your script and it appeared to work
Try setting it as a string like so
s_val = "{0} {1}".format(point.X, point.Y)
parameter.value = s_val