Users can create and share geoprocessing tools in the GIS. The arcgis.geoprocessing module lets you import geoprocessing toolboxes as native Python modules. You can call the functions available in the imported module to invoke these tools. The module also provides simple types that can be used as parameters for these tools along with native Python types.
import_toolbox
- arcgis.geoprocessing.import_toolbox(url_or_item, gis=None, verbose=False)
Imports geoprocessing toolboxes as native Python modules. You can call the functions available in the imported module to invoke these tools.
Parameter
Description
url_or_item
location of toolbox, can be a geoprocessing server url or Item of type: Geoprocessing Service
gis
Optional the
GIS
used for running the tool.active_gis
is used if not specifiedverbose
optional bool, set to True to print the generated module
Returns module with functions for the various tools in the toolbox
DataFile
- class arcgis.geoprocessing.DataFile(url=None, item_id=None, portal_item=None)
A data object containing a data source, used as input/output by some Geoprocessing tools
Parameter
Description
url
optional string, URL to the location of the data file.
item_id
optional string, The id of the uploaded file returned as a result of the upload operation.
portal_item
optional
Item
. A data type item used for GP tool.
LinearUnit
- class arcgis.geoprocessing.LinearUnit(distance, units)
A data object containing a linear distance, used as input to some Geoprocessing tools
Parameter
Description
distance
required number, the value of the linear distance.
units
required string, unit type of the linear distance, such as “Meters”, “Miles”, “Kilometers”, “Inches”, “Points”, “Feet”, “Yards”, “NauticalMiles”, “Millimeters”, “Centimeters”, “DecimalDegrees”, “Decimeters”
RasterData
- class arcgis.geoprocessing.RasterData(url=None, format=None, item_id=None)
A data object containing a raster data source, used as input/output by some Geoprocessing tools
Parameter
Description
url
optional string, URL to the location of the raster data file.
item_id
optional string, The id of the uploaded file returned as a result of the upload operation.
format
optional string, Specifies the format of the raster data, such as “jpg”, “tif”, etc.
GPService
- class arcgis.geoprocessing.GPService(url, gis=None)
A geoprocessing service can contain one or more tools that use input data from a client application, process it, and return output in the form of features, maps, reports, files, or services. These tools are first authored and run in ArcGIS Pro or ArcGIS Desktop, typically as a custom model or script tools, before being shared to an ArcGIS Server.
- property tasks
returns the
GP Tasks
GPTask
- class arcgis.geoprocessing.GPTask(url, parent, gis=None)
The GP Task resource represents a single task in a geoprocessing service published using ArcGIS Server. It provides basic information about the task including its name and display name. It also provides detailed information about the various input and output parameters exposed by the task.
GPInfo
GPJob
- class arcgis.geoprocessing.GPJob(future, gptool, jobid, task_url, gis, notify=False)
Represents a Single Geoprocessing Job. The GPJob class allows for the asynchronous operation of any geoprocessing task. To request a GPJob task, the code must be called with future=True or else the operation will occur synchronously. This class is not intended for users to call directly.
Parameter
Description
future
Required Future object. The async object created by the geoprocessing (GP) task.
gptool
Required Layer. The Geoprocessing Service
jobid
Required String. The unique ID of the GP Job.
task_url
Required String. The URL to the
GPTask
.gis
Required
GIS
. The GIS connection objectnotify
Optional Boolean. When set to True, a message will inform the user that the geoprocessing task has completed. The default is False.
- cancel()
Attempt to cancel the call. If the call is currently being executed or finished running and cannot be cancelled then the method will return False, otherwise the call will be cancelled and the method will return True.
- Returns:
Boolean
- property elapse_time
Get the amount of time that passed while the
GPJob
ran.
- result()
Return the value returned by the call. If the call hasn’t yet completed then this method will wait.
- Returns:
object