Deploying and distributing custom raster functions can now be performed seamlessly by placing any Python raster functions (.py) and their associated raster function templates (.rft.xml) in the well-known home folder. This folder exists on all ArcGIS products, including ArcGIS Pro. As a developer, you will need to set up this folder once and replicate it in the respective ArcGIS installation directories. Then all your custom functions that exist in these folders will be recognized across the platform. When a user applies or publishes a custom function template, the software will automatically look in this location for the associated Python script.
Prior to deploying custom Python raster functions, the developer should ensure that all third-party Python libraries are installed. These associated libraries and the correct version of Python also needs to be installed with ArcGIS Pro. The Python version can be determined by typing the following into the Python window: sys.version_info.
At this point, you can start preparing your raster function templates. Open a template using a text editor or XML editor. Locate the path to the Python file in the XML editor. Change the path to the Python script it is referencing using the well-known home folder path. To do so, use the following syntax: [functions]Custom\subfolder\script1.py.
Deployment in ArcGIS Pro
The developer will then need to place the associated Python scripts and raster function templates into the Custom directory within the well-known home folder, and ArcGIS Server, if applicable. When a user applies or publishes templates, the software will automatically look in this location for the associated Python script. The ArcGIS Pro well-known home folder is located at .\Program Files\ArcGIS\Pro\Resources\Raster\Functions.
Do not copy custom functions into the System folder within the well-known home folder. This is reserved for out-of-the-box functions only.
You will need to create a Custom folder in .\Program Files\ArcGIS\Pro\Resources\Raster\Functions\Custom.
The raster function template and Python file must both be placed in subfolders within the Custom folder. They will automatically show up in the Raster Functions pane. If you do not use subfolders, the functions will not appear in the Raster Functions pane. The subfolders under the Custom folder will be used as the subcategories in the Raster Functions pane. For example, if you have a category called agriculture, use the following folder structure: \Program Files\ArcGIS\Pro\Resources\Raster\Functions\Custom\agriculture.
The Custom tab in the Raster Functions pane will have a subcategory called agriculture.
The Custom function subcategories will be denoted with square brackets ([ ]). These subcategories cannot be edited in ArcGIS Pro.