ESRI Integration Introduction
Introduction
A common workflow when an organisation builds or receives a new asset is to create a new feature for the asset in the ESRI via ArcMap/ArcGIS Pro and then a corresponding new asset in Assetic. To ensure that when a new asset is linked to the correct feature, Assetic has created a set of data capture integration tools.
Asset Workflow
These tools support the workflow shown in the diagram below:
Ideally asset attributes are managed in Assetic. In other words Assetic is the definitive source for Asset attributes, with ArcMap/ArcGIS Pro a consumer of the attributes. This is usually achieved by holding the Assetic asset ID in ArcMap and using table joins to join the ArcMap/ArcGIS Pro data with a local copy of the relevant Assetic asset attributes.
Functional Location Workflow
A similar work flow is provided for Assetic Functional Location creation and update from an ESRI layer. A layer that directly corresponds to Functional Locations is used to create/update the Functional Location in Assetic. This includes attributes of the Functional Location.
Integration Architecture
When an ESRI product is installed it includes a set of python tools packaged as 'arcpy'.
Assetic have built a python package 'assetic_esri' that utilise these tools to assist with creating and maintaining asset records in both systems. The 'assetic_esri' package assists with getting relevant asset detail from an ESRI feature and applying that detail in Assetic, and if necessary updating the ESRI feature with relevant detail (such as an asset ID generated by Assetic on asset creation). The 'assetic_esri' package itself relies on the generic Assetic python SDK packaged as 'assetic'.
Depending on the ESRI environment there are different options for implementing the integration:
- Python Add for ArcMap - use the Assetic ESRI Python Add-In to create a toolbar in ArcMap that initiates integration actions.
- ArcGIS Pro - use an ESRI toolbox to create toolbox actions that initiate integration actions.
- Scripted process - use a python script run at scheduled intervals to initiate integration actions.
- ModelBuilder - use a script toolset within an ESRI ModelBuilder model.
All of the above listed options utilise the assetic_esri package
Installation of assetic_esri package
It is assumed that the python 'pip' utility has been installed as part of the ArcMap installation. ArcMap 10.3 or earlier may not include 'pip', however it can easily be installed. ArcGIS Pro has pip installed since it is a newer product.
To install the 'assetic_esri' package open a command prompt window and type:
pip install assetic_esri
and press enter.
If the 'assetic_esri' package is already installed and you wish to upgrade it, include the "--upgrade" keyword in the pip command as shown below:
pip install assetic_esri --upgrade --upgrade-strategy only-if-needed
Refer to the article Assetic-Python-SDK-Quick-Start for more details on how to use pip to install Assetic packages.
To verify that the assetic_esri package has installed, restart ArcMap/ArcGIS Pro and from the python command window type:
import assetic_esri
If there was a problem with installation, you will get error messages. If 'assetic_esri' is properly installed then there will be no message and python will await your next command.
Python in ArcGIS Pro
Recent versions of ArcGIS Pro (>= 2.2) require a conda clone to be created to allow installation of external python packages such as the assetic_esri package. Refer to the following link for more information: https://pro.arcgis.com/en/pro-app/arcpy/get-started/what-is-conda.htm
The following batch file can be used to install or upgrade the assetic_esri package. The batch file activates the cloned conda environment and then applies the install/upgrade of the assetic package.
The example below will install/upgrade the assetic_esri package in the conda environment "arcgispro-py3-clone1"
Usage: UpgradeAsseticEsriPackagePro.bat arcgispro-py3-clone1
Hint: You may need to right click and 'Save As' to download
- echo off
- rem activate the conda environment that support adding packages
- rem accepts a single parameter of the conda environment name
- IF "%1"=="" (
- echo Need to provide a conda environment.
- echo example usage:
- echo UpgradeAsseticEsriPackagePro.bat arcgispro-py3-clone1
- exit /B 1
- )
- call "C:\Program Files\ArcGIS\Pro\bin\Python\Scripts\activate" %1
- rem now pip shoud be available in the environment
- rem install/upgrade the assetic_esri package,
- rem being careful not to upgrade existing dependent packages
- rem unless the asset packages specify a more recent package
- echo on
- pip install assetic_esri --upgrade --upgrade-strategy only-if-needed