This Button add-in, when clicked, uses the first Polygon layer in the Map and runs a buffer operation with help of a Python script. It reads the text stream output from python and displays it.
Language: C#
Subject: Geoprocessing
Contributor: ArcGIS Pro SDK Team <arcgisprosdk@esri.com>
Organization: Esri, https://www.esri.com
Date: 04/04/2024
ArcGIS Pro: 3.3
Visual Studio: 2022
.NET Target Framework: net8.0-windows
- Sample data for ArcGIS Pro SDK Community Samples can be downloaded from the Releases page.
- This solution file includes an example python script named test1.py which is included as 'Content' (Build action) in the add-in.
- This sample also requires an ArcGIS Project with a map that has at least one polygon layer in the Map's table of content.
- Rebuild the project in Visual Studio and debug.
- In ArcGIS Pro open a project with a map that has one polygon layer in the Map's TOC.
- Make sure the Map is the active map.
- Go to the ADD-IN Tab, find the "Python Script" group and click "Show Python Feedback" followed by "Run Py Script".
- The "Run Python Script" Dockpane will populate the "In" and "Out" feature classes used for the script's buffer operation.
- Note: the "In" feature class is derived from the first feature layer in the active Map's table of content.
- Note: the "Out" feature class is derived from the "In" feature class with a "_Buffer" appended to the feature class name.
- Note: if the "Out" feature class exists the code will delete the feature class in order for the script to work.
- The Feedback from Python is displayed in the dockpane:
- If you have ArcGIS Pro installed and licensed on your machine you should be able to run this python script directly from a Windows command prompt.
- To do so open a Windows Command prompt and copy/paste the content from the Dockpane's 'Command line' field.
Home | API Reference | Requirements | Download | Samples