Skip to main content

Python utilities for use with Esri ArcGIS Pro software

Project description

README

What is this repository for?

  • A collection of (mostly) arcpy related utilities for use within ArcGIS Pro (Python 3). Shortcuts for accessing elements of a map document, performing various data discovery tasks on a table or geodatabase

How do I get set up?

Install from PyPI:

pip install arc-utils

For local development and editable usage from clone:

python -m pip install -e .

To use the utilities:

  • in the python window in ArcGIS Pro

import arc_utils as au

  • typing au. will now reveal the modules and functions available to you if you have autocomplete on

  • Depends on arcpy (only available with Esri license)

Example usage

import arc_utils as au

tbl = au.table.TableObj(path to featureclass)

list all fields

print(tbl.fields)

pro_doc = au.aprx.AprxObj(“CURRENT”)

pro_doc.maps >> [<arcpy._mp.Map object at 0x000001A4AECBF108>, <arcpy._mp.Map object at 0x000001A4AEBB6608>]

pro_doc.maps[0].name >> ‘Map’

Accepted Input Types

Most path parameters now accept:

  • string path
  • pathlib.Path / other path-like objects
  • wrapper objects with .path
  • ArcGIS layer/table objects with .catalogPath or .dataSource (where applicable)

Invalid paths raise ValueError("invalid path").

Constructor acceptance is preserved (for example, passing path-like and wrapper objects directly to TableObj, GDBObj, and AprxObj).

Exporting field values to Excel

import arc_utils as au
from openpyxl import Workbook

# Single table export with class method
tbl = au.table.TableObj(r"C:\path\to\featureclass")
wb = Workbook()
ws = wb.active
tbl.export_fields_to_worksheet(ws)
wb.save(r"C:\path\to\schema_values.xlsx")
# Multi-layer export with module function
layers = [r"C:\path\to\layer1", r"C:\path\to\layer2"]
au.table.export_field_sets(layers, r"C:\path\to\all_layers.xlsx")
# Worksheet naming behavior:
# use_lyr_alias=True -> prefer alias/name (human-readable)
# use_lyr_alias=False -> use full table path (traceable)
au.table.export_field_sets(layers, r"C:\path\to\all_layers.xlsx", use_lyr_alias=True)
au.table.export_field_sets(layers, r"C:\path\to\all_layers_by_path.xlsx", use_lyr_alias=False)
# Duplicate detection outputs
tbl = au.table.TableObj(r"C:\path\to\featureclass")
dup_values = tbl.find_duplicate_field_values("STATUS", output="set")
dup_rows_df = tbl.find_duplicate_field_values(["STATUS", "TYPE"], output="df")

Contribution guidelines

Contributions welcomed, this is a starting point for various utilities that I think could be useful within ArcGIS Pro.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

arc_utils-1.3.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

arc_utils-1.3-py3-none-any.whl (21.3 kB view details)

Uploaded Python 3

File details

Details for the file arc_utils-1.3.tar.gz.

File metadata

  • Download URL: arc_utils-1.3.tar.gz
  • Upload date:
  • Size: 18.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for arc_utils-1.3.tar.gz
Algorithm Hash digest
SHA256 1f315456a1ae7ba315b3532465f8966b4a7b5dbe6c097d824e7de6731888b30e
MD5 b4c78a987a2e1920086838473001b31d
BLAKE2b-256 afeac407af4e6d1103cc3c9e13a1094226b081cf65c9c2ae2374b53f6772c85a

See more details on using hashes here.

File details

Details for the file arc_utils-1.3-py3-none-any.whl.

File metadata

  • Download URL: arc_utils-1.3-py3-none-any.whl
  • Upload date:
  • Size: 21.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for arc_utils-1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 42a555813a1919a8895b15b61b522d1335a166f843dc62459b1aff6bf3e49aa5
MD5 963ba8878687b4fbcd07ff1ed0cb16ed
BLAKE2b-256 8c5230775f65b082425ad2a851441deeaa65e9579114339dd59ae532911798ec

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page