Docs home
ArcSmith documentation
ArcSmith is a Python library for GIS researchers that want to shape rough scripts into polished .pyt tools. ArcSmith covers parameter state management, layer outputs, field mappings, feature-class filtering, table joins, and workspace setup through six focused modules.
-
Named helpers for
updateParameters. Parameter state detection, cascade resets, dropdown population, and controlling groups of dependent parameters. -
Add layers to a map with optional stroke/fill or
.lyrxsymbology, retrieve or remove layers by name or source, and organize layers into groups. -
Create the output geodatabase and its parent folder in one call. Route intermediate outputs to
memoryor scratch GDB with a single flag. -
Build SQL WHERE clauses with automatic delimiting and quoting, including multi-value IN filters. Export a feature class to a new location with optional field and row filtering, validate geometry, and compute area.
-
Build field mappings, keep or drop fields when copying, standardize blank values, and list column names or unique values for dropdown population.
-
Create standalone tables from in-memory rows, populate a field from a
{key: value}lookup with no physical table, and permanently join an external table's columns into a feature class.
Module demonstration toolboxes
Ready-to-open demo toolboxes. One .atbx file per ArcSmith module.
Function references
All functions listed alphabetically within each module.
arcsmith.param
Named helpers for updateParameters and updateMessages. Covers parameter state detection, cascade resets, dropdown population, controlling groups of dependent parameters, and timely self-clearing validation messages.
| Function | Description |
|---|---|
cascade_clear |
Clear downstream parameters the moment an upstream value changes |
cascade_populate |
Assign a value to downstream parameters when an upstream value changes |
checkbox_dependence |
Show, hide, and seed parameters controlled by a checkbox |
drop_populate |
Fill a parameter's dropdown list |
dynamic_dropdown |
Enable and disable parameter groups based on a dropdown selection |
flag |
Show a self-clearing message on a parameter while a condition holds |
require |
Prompt for a parameter that must be filled before the tool runs, self-clearing |
require_one_of |
Prompt when at least one of a group of parameters must be filled |
state |
Translate altered + hasBeenValidated into a single readable state string |
to_path |
Resolve a feature class or layer parameter to its catalog path |
arcsmith.lyr
Add layers to a map with optional .lyrx symbology, apply symbology to existing layers, apply simple inline fill and stroke, retrieve or remove layers by display name or data source path, reorder layers within their level, and organize layers into group layers.
| Function | Description |
|---|---|
add |
Add a data source to a map as a new layer, with optional symbology and display name |
add_to_grp |
Move an existing layer into a group layer, with optional precise ordering and removal of the original |
apply_lyrx |
Apply .lyrx symbology to a layer object, or to layers in the map matched by name or source |
get |
Retrieve layers from the map TOC by display name or data source path |
get_grp |
Retrieve group layer(s) from the map TOC by display name |
make_grp |
Create a group layer, optionally moving existing layers into it on creation |
move |
Reorder a layer within its current TOC level, relative to a sibling or to the top/bottom |
remove |
Remove layers of any type from the map TOC by display name or data source path |
simple_sym |
Apply simple fill color, fill opacity, stroke color, and stroke width to a layer, or apply a named style preset |
For ready-made fills and cartographic presets, plus the hollow boundary presets, used by simple_sym, see the style presets catalog.
arcsmith.ws
Create the output geodatabase and its parent folder in one call. Route intermediate outputs to memory or scratch GDB by flipping a single flag.
| Function | Description |
|---|---|
init_gdb |
Create a file geodatabase, creating the parent folder if needed |
temp_space |
Return a workspace path for intermediate outputs, either memory or scratch GDB |
arcsmith.fc
Build SQL WHERE clauses with automatic field delimiting and value quoting, including multi-value IN filters. Export a feature class to a new location with optional field and row filtering, including a straight copy into a geodatabase. The module also validates geometry types and computes polygon area.
| Function | Description |
|---|---|
build_where |
Build a SQL WHERE clause for a single field, handling delimiters and quoting automatically |
build_where_in |
Build a SQL IN or NOT IN clause for a list of values, handling delimiters and quoting automatically |
export_fc |
Export a feature class to a new location with optional field and row filtering, including copying one into a geodatabase |
get_area |
Return the area of a polygon feature class with optional unit conversion |
validate_geom_type |
Check whether a feature class has an expected geometry type |
arcsmith.flds
Build field mappings, add/rename/delete fields in place, keep or drop fields when copying a feature class, standardize blank values across string fields, and list column names or unique values for dropdown population.
| Function | Description |
|---|---|
add_fld |
Add a new field to a feature class or table in place |
build_fld_map |
Build a FieldMappings object retaining or dropping specified fields |
clean_blanks |
Standardize blank-like values in string fields to a single canonical value |
del_fld |
Delete one or more fields from a feature class or table in place |
list_cols |
Return the field names present in a feature class |
rename_fld |
Rename a field, and optionally its alias, in place |
unique_values |
Return the unique values or value combinations present in one or more fields |
arcsmith.tbl
Create standalone tables from in-memory rows, append rows to an existing table, populate a field from a {key: value} lookup without building a physical table, permanently join an external table's columns into a feature class, and add, find, or remove standalone tables in a map.
| Function | Description |
|---|---|
add_rows |
Append rows of Python data to an existing table or feature class |
add_to_map |
Add a standalone table to a map's table-of-contents |
from_rows |
Create a standalone table from an in-memory list of rows, with explicit or inferred field types |
get |
Retrieve standalone table(s) from a map by display name or data source path |
join_lookup |
Add a field and populate it from a 1:1 {key: value} lookup, with no physical table |
join_table |
Join an external table to a feature class permanently, copying its columns in |
remove_from_map |
Remove standalone table(s) from a map by display name or data source path |