arcgis.geoprocessing module¶
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.
Argument
Description
url_or_item
location of toolbox, can be a geoprocessing server url or Item of type: Geoprocessing Service
gis
optional GIS, the GIS used for running the tool. arcgis.env.active_gis is used if not specified
verbose
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)¶ A data object containing a data source, used as input/output by some Geoprocessing tools
Argument
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.
-
download
(save_path=None)¶ Downloads the data to the specified folder or a temporary folder if a folder isn’t provided
-
classmethod
from_dict
(datadict)¶ Creates an instance of this class from its dict representation.
-
classmethod
from_str
(url)¶ Creates a data file from a url.
-
to_dict
()¶ Converts an instance of this class to its dict representation.
-
LinearUnit¶
-
class
arcgis.geoprocessing.
LinearUnit
(distance, units)¶ A data object containing a linear distance, used as input to some Geoprocessing tools
Argument
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”
-
classmethod
from_dict
(datadict)¶ Creates an instance of this class from its dict representation.
-
classmethod
from_str
(how_far)¶ Creates a linear unit from a string like ‘5 miles’.
-
to_dict
()¶ Converts an instance of this class to its dict representation.
-
classmethod
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
Argument
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.
-
classmethod
from_dict
(datadict)¶ Creates an instance of this class from its dict representation.
-
to_dict
()¶ Converts an instance of this class to its dict representation.
-
classmethod
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.
Argument
Description
future
Required ccurrent.futures.Future. 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 GP Task.
gis
Required GIS. The GIS connection object
notify
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
-
cancelled
()¶ Return True if the call was successfully cancelled.
- Returns
boolean
-
done
()¶ Return True if the call was successfully cancelled or finished running.
- Returns
boolean
-
property
ellapse_time
¶ Returns the Ellapse Time for the Job
-
result
()¶ Return the value returned by the call. If the call hasn’t yet completed then this method will wait.
- Returns
object
-
running
()¶ Return True if the call is currently being executed and cannot be cancelled.
- Returns
boolean
-
property
status
¶ returns the GP status
- Returns
String
-
property
task
¶ Returns the task name. :returns: string
-