Server Tool alias?

653
0
08-20-2014 02:18 PM
KevinBell
Occasional Contributor III

http://resources.arcgis.com/en/help/main/10.1/index.html#//00570000004w000000

This has the following code sample:

import arcpy
import time

arcpy.ImportToolbox("http://sampleserver1.arcgisonline.com/ArcGIS/services;Elevation/ESRI_Elevation_World", "viewshedAlias")

result = arcpy.Viewshed_viewshedAlias(r'c:\data\inputPoint.shp', "10000 Kilometers")

while result.status < 4:
  print result.status
  time.sleep(0.2)
print "Execution Finished"

result.getMessages()
arcpy.CopyFeatures_management(result.getOutput(0), 'localResult.shp')

With this sample above, I don't get the alias here.  They import the toolbox and give it an alias, but how does the following line know the alias?  viewshedAlias is not part of arcpy.

result = arcpy.Viewshed_viewshedAlias(r'c:\data\inputPoint.shp', "10000 Kilometers")

I tried something like this:

arcpy.ImportToolbox(r"http://myserver/arcgis/rest/services;aFolder/aTool", "myTool")

result = myTool(r'C:\gisProject\default.gdb\aPoint', "1000 Feet")

...but it errors saying 'myTool' is not defined.  What am I missing about the alias?

0 Kudos
0 Replies