This project provides a Python Toolbox (.pyt) and core logic script for ArcGIS Pro that allows users to import sketches and drawings exported from the ArcGIS Experience Builder Draw Widget. It converts the web-based JSON format into native, high-quality graphics within an ArcGIS Pro Graphics Layer.
- Comprehensive Geometry Support: Imports Points, Polylines, Polygons, and Text elements.
- High-Fidelity Symbol Styling: Uses the ArcGIS Pro CIM (Cartographic Information Model) to replicate web styles:
- Points: Supports vector markers and embedded images (Base64/URL).
- Lines & Polygons: Supports various dash patterns, stroke widths, fill colors, and transparency.
- Text: Preserves font family, size, halos, rotation, and alignment, including automatic text wrapping.
- Structured Organization: Automatically organizes imported graphics into groups by Geometry Type and Style for a cleaner Contents pane.
- Coordinate Management: Detects and applies the spatial reference (WKID) defined in the source JSON.
- Summary Reporting: Provides a detailed breakdown of total elements imported (Points, Lines, Polygons, and Text) in the geoprocessing messages.
- Download the Files: Save both
ExperienceBuilderDrawImport.pytandexb_draw_import_core.pyinto the same folder on your local machine. - Add to ArcGIS Pro:
- Open your ArcGIS Pro project.
- In the Catalog pane, right-click on Toolboxes.
- Select Add Toolbox.
- Browse to and select
ExperienceBuilderDrawImport.pyt.
- Export from Web: In your ArcGIS Experience Builder application, use the Draw widget to export your sketches to a JSON file.
- Run the Tool: In the ArcGIS Pro Catalog pane, expand the toolbox and double-click the Import Experience Builder Draw JSON tool.
- Set Parameters:
- Input Experience Builder JSON: Browse to your exported JSON file.
- Execute: Click Run.
- The tool identifies the active map.
- A new Graphics Layer is created with a timestamped name.
- Check the geoprocessing messages for a summary of the import.
- Requirements: Designed for ArcGIS Pro 3.x (utilizing Python 3 and the V3 CIM specification).
- Graphics Layer Advantage: Instead of creating Feature Classes, this tool uses a Graphics Layer to allow for mixed geometry types and unique, per-element styling that matches the "sketch" nature of the source data.
- Image Handling: For Picture Marker Symbols, the core script extracts image data to temporary files to ensure they render correctly within the Pro environment.
ExperienceBuilderDrawImport.pyt: The ArcGIS Python Toolbox file defining the tool interface, parameters, and basic execution flow.exb_draw_import_core.py: The core logic engine responsible for JSON parsing, geometry conversion, and complex CIM symbol mapping.