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

geoprocessing.import_toolbox(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 tempoary 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.

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.