ArcPy provides a number of functions to better support workflows using Python.
In addition to the functions listed in this topic, all geoprocessing tools can be accessed as ArcPy functions; see Using tools in Python for more information. Additional functions can be found in other ArcPy modules, including the following:
- チャート (arcpy.charts)
- データ アクセス (arcpy.da)
- ジオコーディング (arcpy.geocoding)
- Image Analysis (arcpy.ia)
- マッピング (arcpy.mp)
- メタデータ (arcpy.metadata)
- Network Analyst (arcpy.nax と arcpy.na)
- 共有 (arcpy.sharing)
- Spatial Analyst (arcpy.sa)
- Workflow Manager (arcpy.wmx)
Learn more about using functions in Python
ArcGIS Online / Portal functions
Function | Description |
---|---|
Removes ArcGIS Server credential information from a client machine to disable access to secured services. | |
Returns the URL of the active portal. | |
Returns a dictionary of portal information. | |
Returns a dictionary that contains information about available portals. | |
Returns token information when signed in to ArcGIS.com or a local portal. | |
Imports credentials from a GIS server connection file for ArcGIS Server nontoken-based secured services. | |
Returns a list of available portal URLs. | |
Allows you to sign in to a portal. |
Cursor functions
Function | Description |
---|---|
Inserts rows of attribute values into a specified feature class or table. | |
Returns rows of attribute values from a feature class or table. | |
Updates or deletes rows of attribute values from a feature class or table. |
Data store functions
Function | Description |
---|---|
Registers a folder or database with an ArcGIS Server site. | |
Returns a list of the folders or databases registered with an ArcGIS Server site. | |
Unregisters a folder or database from an ArcGIS Server site. | |
Validates whether a folder or database has been successfully registered with an ArcGIS Server site. |
Describing data functions
Function | |
---|---|
Describes a data element and returns a Describe object with multiple properties, such as data type, fields, indexes, and many others. Its properties are dynamic, meaning that depending on the data type described, different describe properties will be available for use. |
Environment functions
Function | Description |
---|---|
Resets a specific environment setting to its default. | |
Gets a specified system environment variable value, such as TEMP. | |
Returns a list of geoprocessing environment names. | |
Resets all environment settings to their default settings. |
Field functions
Function | Description |
---|---|
Adds field delimiters to a field name to allow for use in SQL expressions. | |
Parses a fully qualified field name into its components (database, owner name, table name, and field name) depending on the workspace. ParseFieldName returns a string that includes the parsed table name and contains the database, owner, table, and field names, separated by commas. The workspace must be a file, or enterprise geodatabase. | |
Returns a valid field name for a database based on a field name and a path to a database. All invalid characters in the input field name are replaced with an underscore. The field name restrictions depend on the type of database. |
General functions
Function | Description |
---|---|
Opens a local or cloud file handle that supports context manager protocol. | |
Updates the alias name for a table or feature class. | |
Returns the factor for converting an area measurement to a different areal unit. | |
Runs a geoprocessing tool as a single string. | |
Creates a geoprocessing object. The extra arguments can be used to specify additional requirements for the object creation such as the number of columns in the ValueTable object. | |
Creates a new random number generator. | |
Determines whether the given dataset or workspace is in an edit session. | |
Returns the factor for converting a distance measurement to a different linear unit. | |
Returns a list of available printers on the local computer. | |
Refreshes the map views containing the specified layers. | |
Returns the syntax for the specified tool or function. |
General data functions
Function | Description |
---|---|
Creates a unique scratch path name for the specified data type. If no workspace is given the current workspace is used. | |
Creates a unique name for the specified workspace by appending a number to the input name. This number is incremented until the name is unique. If no workspace is specified, the current workspace is used. | |
Determines the existence of the specified data object. This function tests for the existence of various data types including feature classes, tables, datasets, shapefiles, workspaces, layers, and files. The function returns a Boolean indicating whether the element exists. | |
Parses a table name into its components (database, owner, table) depending on the workspace. ParseTableName returns a string containing the parsed table name, with the database name, owner name, and table name, separated by commas. This workspace must be a personal, file, or enterprise geodatabase. | |
Tests if a schema lock can be acquired for a feature class, table, or feature dataset. Tools that alter schema will require a schema lock to be placed on the input data. The Add Field tool is an example of such a tool. If the tool requires a schema lock and is unable to acquire one when the tool is run, an appropriate error message is returned. Scripts that use such tools should test if a schema lock can be acquired on the input data. The TestSchemaLock function will not actually apply a schema lock on the input data, but will return a Boolean. | |
Returns a valid table name for a workspace based on a table name and a workspace path. All invalid characters in the input table name are replaced with an underscore. The table name restrictions depend on the type of database. |
Geodatabase administration functions
Function | Description |
---|---|
Allows an administrator to enable or disable the ability of nonadministrative users to make connections to an enterprise geodatabase. | |
The DisconnectUser function allows an administrator to disconnect users who are currently connected to an enterprise geodatabase. | |
Returns a list of named tuples containing information for users who are connected to an enterprise geodatabase. |
Geometry functions
Function | Description |
---|---|
Converts Esri JSON or GeoJSON geometry to ArcPy geometry, and Esri JSON feature sets to ArcPy feature sets. GeoJSON is a geospatial data interchange format for encoding geographic data structures. | |
Converts a coordinate system notation string to a PointGeometry object in WGS84 coordinates. | |
Converts a geohash string to an Extent object in WGS 1984 coordinates that represents the corresponding bounding box in the geohash grid. | |
Creates a geometry object from a well-known binary (WKB) string stored as a bytearray or bytes object. | |
Creates a geometry object from a well-known text (WKT) string. |
Licensing and installation functions
Function | Description |
---|---|
Checks to see if a license is available to be checked out for a specific type of extension. | |
Returns the license to the License Manager so other applications can use it. | |
Retrieves the license from the License Manager. | |
Checks to see if the requested license is available. | |
Returns a dictionary that contains information about the installation. | |
Returns a list of installation types. | |
Returns the current product license. |
Listing data functions
Function | Description |
---|---|
Returns a list of datasets in the current workspace. Search conditions can be specified for the dataset name and dataset type to limit the list that is returned. | |
Returns a list of the feature classes in the current workspace, limited by name, feature type, and optional feature dataset. | |
Returns a list of fields in a feature class, shapefile, or table in a specified dataset. The returned list can be limited with search criteria for name and field type and will contain Field objects. | |
Returns a list of files in the current workspace. | |
Returns a list of the indexes in a feature class, shapefile, or table in a specified dataset. | |
Returns a list of the rasters in the current workspace. | |
Returns a list of tables in the current workspace. | |
Lists the versions the connected user has permission to use. | |
Returns a list of workspaces in the current workspace. |
Logging functions
Function | Description |
---|---|
Determines whether history logging is active. | |
Determines whether geoprocessing operations are written to dataset metadata. | |
Controls whether information about the execution of geoprocessing tools is written to an external log file. | |
Controls whether geoprocessing tool input and output datasets' metadata is updated to include the tool name, parameters, when the tool was run, and other information. |
Message and error handling functions
Function | Description |
---|---|
Adds an error message (severity of 2) to the messages of a script tool or Python toolbox tool. | |
Use system ID messages with a script tool. | |
Adds an informative message (severity of 0) to the messages of a script tool or Python toolbox tool. | |
Sets the return message of a script tool as an output message by index. | |
Adds a warning message (severity of 1) to the messages of a script tool or Python toolbox tool. | |
Returns the message types, return codes, and message strings from the previously run tool. | |
Get the string of the error or warning ID message. | |
Gets the maximum severity returned from the previously run tool. | |
Returns a geoprocessing tool message by index position. | |
Returns a numeric count of all the returned messages from the previously run tool. | |
Returns the geoprocessing messages from a tool by a specified severity level. | |
Returns the message error code for a geoprocessing message. | |
Gets the severity code (0, 1, 2) of the specified message by index. | |
Returns the severity level. The severity level is used to control how geoprocessing tools throw exceptions. | |
Sets additional categories of informative messages to be returned with geoprocessing tool messages. | |
Controls how geoprocessing tools throw exceptions. |
Parameter functions
Function | Description |
---|---|
Copies the specified parameter by index or parameter name to another parameter in the script tool. The specified parameters must be of the same data type. | |
Returns the number of arguments passed to the script. | |
From the parameter list, select the desired parameter by its index or its name. The parameter is returned as an object. | |
Gets the specified parameter as a text string by its index position or parameter name. | |
Returns a count of the parameter values for the specified tool. If the tool is contained in a custom toolbox, use the ImportToolbox function to access the custom tool. | |
Returns a list of parameter objects for a given tool and is commonly used in a script tool's ToolValidator class. | |
For a specified tool name, returns the default value of the desired parameter. The parameter is specified by either index or parameter name. | |
Sets a specified parameter property by index or parameter name using an object. This function is used to pass objects from a script to a script tool. If you need to pass a string, use the SetParameterAsText function. | |
Gets the specified parameter as a text string by its index position or parameter name. | |
Sets the symbology properties of the specified output parameter of a script tool by index or parameter name. |
Progress dialog functions
Function | Description |
---|---|
Resets the progressor to its initial state. | |
Establishes a progressor object to support progress information to be displayed in the Geoprocessing pane. The appearance of the progressor can be controlled by choosing either the default progressor or the step progressor. | |
Updates the progressor label in the Geoprocessing pane. | |
Updates the progressor status bar in the Geoprocessing pane. |
Publishing functions
Function | Description |
---|---|
Converts a locator to a Service Definition Draft file (.sddraft) that can be used to create a service definition for publishing a geocode service. | |
Converts Result objects and result files (.rlt) to a service definition draft file (.sddraft). | |
Converts a raster or mosaic dataset to a Service Definition Draft file (.sddraft). |
Raster functions
Function | Description |
---|---|
Returns EXIF header information from a geotagged image. | |
Converts a NumPy array to a raster. | |
Converts a raster to a NumPy array. | |
Creates a rendered raster object by applying symbology to the referenced raster dataset. This function is useful when displaying data in a Jupyter notebook. |
Spatial reference and transformation functions
Function | Description |
---|---|
Generates a SpatialReference object with a custom projected coordinate system optimal for the specified extent and intended purpose of your map or analysis. | |
Returns a list of available spatial reference names for use as an argument to the SpatialReference class. | |
Returns a list of valid transformation methods. An extent can be used to narrow the list of valid transformation methods for a specific geographic area. |
Tool and toolbox functions
Function | Description |
---|---|
Imports the specified toolbox into ArcPy, allowing for access to the toolbox's associated tools. | |
Decrypt an encrypted Python toolbox file. | |
Encrypts a Python toolbox file. | |
Imports a geoprocessing toolbox for use in ArcPy, allowing access to the toolbox's associated tools. | |
Determines if a tool is running synchronous or asynchronous. When a tool is synchronous, the results are automatically returned, but no other action may be taken until the tool has completed. All non-server tools are synchronous. Server tools may be asynchronous, meaning that once the tool has been submitted to the server, other functionality can be run without waiting, and the results must be explicitly requested from the server. | |
Returns a list of toolboxes. | |
Returns a list of geoprocessing tools. | |
Removes the specified toolbox, either by specifying its path or referencing its alias. Removes the specified toolbox from the current geoprocessing session. Server toolboxes can also be removed using a semicolon delimiter. |