I'm trying to create a script that will access an AGOL hosted feature service (polygon), run a FeatureToPoint geoprocessing task against it, and overwrite a separate hosted feature service. Below is a code snippet
outFC = "C:/GIS/AmericanWater/JamesMitchell/Poly2Point.gdb/WVAW_LineB_Projects_Points"
shh = securityhandlerhelper.securityhandlerhelper(securityinfo=securityinfo)
if shh.valid == False:
print shh.message
else:
fl= FeatureLayer(
url=PolyUrl,
securityHandler=shh.securityhandler,
proxy_port=proxy_port,
proxy_url=proxy_url,
initialize=True)
sql = "MapReady = 'Yes'"
resFeats = fl.query(where=sql)
arcpy.FeatureToPoint_management(resFeats,outFC,"CENTROID")
fl = PointUrl
print fl.updateFeature(features=resFeats)
print "Finished"
I get the following message when it reaches the FeaureToPoint geoprocessing tool
Traceback (most recent call last):
File "G:\ArcMap Settings\Python\Poly2Point.py", line 53, in <module>
arcpy.FeatureToPoint_management(resFeats,outFC,"CENTROID")
File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\management.py", line 2583, in FeatureToPoint
raise e
RuntimeError: Object: Error in executing tool
It seems like the tool doesn't like that my input features are coming from a AGOL hosted service. Does this matter? Is there a way around this?
Thanks,
James