--- name: geodms-simplify-polygons description: Simplify polygon boundaries or convert a categorical grid to polygons with GeoDMS grid2poly. Use for shared-boundary simplification, raster polygonization, and comparing grid resolution and simplification tolerance while checking holes, coverage, and area change. --- # Simplify polygons and polygonize grids with GeoDMS Produce a reproducible GeoDMS configuration, exported polygons with stable source identifiers, and a quality report. Distinguish simplification of individual features from simplification of a polygon coverage. ## Choose the operation - For independent polygon features where shared boundaries need not agree, consult [simplify geometry](https://github.com/ObjectVision/GeoDMS/wiki/Simplify-geometry) and its operator references. - For adjacent polygons, rasterize the zone identifiers and use the installed `grid2poly` template, which simplifies shared boundary segments together. - For an existing categorical grid, use its zone relation directly. Do not rasterize a grid again. Preserve the distinction between a class identifier and a connected component identifier; one class can have multiple disconnected parts. Establish the input layer or grid, zone identifiers, coordinate system, output format, grid resolution, and permitted geometric error from the request and files. Ask only for decisions that materially affect the result. Rasterization can remove narrow features and small regions and change connectivity; shared-boundary processing does not guarantee preservation of every feature of the original vector topology. ## Sources and starting configurations Read the [grid2poly topic page](https://github.com/ObjectVision/GeoDMS/wiki/Poly-to-grid-to-%28simplified%29-polygon) for the installed template and historical differences. Prefer `/examples/grid_to_polygon.dms` and `/library/geometry/grid2poly.dms` from the same GeoDMS release. The example uses CBS neighbourhood data and may download it; inspect the source-data location and dependencies before running it. Its `/checks` item checks coverage, area change, vertex reduction and overlap tolerance. For synthetic examples and resolution comparisons, inspect the [Academy polygon project](https://github.com/ObjectVision/GeoDMS_Academy/tree/main/poly_2_grid_2_simplified_poly/cfg), starting with `stam.dms` and `stam/sourcedata.dms`. Its older `grid2poly_spoint` and `grid2poly_ipoint` copies are learning material, not drop-in replacements for the installed template. Preserve the example's directory structure when downloading it. ## Prepare and compute 1. Work in a new configuration beside the user's inputs; leave source data unchanged. Inspect the installed example and template signature before adapting them. 2. Use an appropriate projected coordinate system for tolerances expressed in metres. Check axis order, grid origin, extent, cell dimensions and NoData. Document how overlapping source polygons are resolved before rasterization. 3. Use an `ipoint` grid for the current installed template. Its five arguments are the grid domain, zone domain, grid-to-zone relation, coordinate unit and simplification factor. The following is a wiring example, not a standalone configuration; the input units and attributes must already exist: ```dms #include <%exeDir%/library/geometry/grid2poly.dms> attribute zone_rel(domain_grid) := poly2grid(zones/geometry, domain_grid); container simplified := grid2poly(domain_grid, zones, zone_rel, coordinate_system, tolerance); attribute result(zones, polygon) := simplified/Results/geometry; ``` 4. Match `coordinate_system` and `tolerance` to the installed example's types and units. Grid resolution and simplification tolerance are separate choices. A zero tolerance still removes redundant collinear vertices; it does not undo rasterization. 5. Begin with a small extent containing a shared boundary, a hole, a narrow feature and a disconnected region. Compare more than one resolution if the requested accuracy is uncertain. Grid cell count grows approximately fourfold when cell width is halved in both directions. 6. Configure export storage explicitly, using the installed release's [vector-writing documentation](https://github.com/ObjectVision/GeoDMS/wiki/gdalwrite.vect). Export identifiers with geometry. Merely calculating an attribute does not create a GIS file. ## Execute and verify Locate an existing compatible `GeoDmsRun.exe` first. If absent, use [official releases](https://github.com/ObjectVision/GeoDMS/releases) and [installation instructions](https://github.com/ObjectVision/GeoDMS/wiki/Installation-Instructions); install the release with its libraries rather than downloading an isolated executable. Record the version and source-data snapshot. Follow the [GeoDMS Run guide](https://github.com/ObjectVision/GeoDMS/wiki/User-Guide-GeoDMS-Run). Put `/L` first with an absolute log path. Item paths are relative to the configuration root: a top-level `container model` does not add `/model` to them. Use `@statistics` on the result or explicit `IntegrityCheck` items to force data evaluation. A bare item request can complete at metadata level when no storage or check requires the data. Capture exit status and inspect the log for errors; success alone does not establish a valid export. `@dumpconfig ` writes the loaded tree — including the instantiated template — for inspection, and `@valueinfo ` explains one output value; the [geodms-run skill](https://raw.githubusercontent.com/wiki/ObjectVision/GeoDMS/ai/.skills/geodms-run/SKILL.md) in this catalog covers the full GeoDmsRun contract, including unattended installation. Compare source, rasterized and final results separately. Report missing zone IDs, holes retained or lost, per-zone and total area deviation, vertex counts, geometry validity, overlaps and gaps. Set tolerances for the user's data, not by copying the CBS example's thresholds. Small numerical slivers are possible; do not promise zero overlap without measuring it. Check the written file's CRS, feature count and identifiers after reopening it. Deliver the `.dms` configuration, exported dataset, log and short report with resolution, tolerance, units, measured errors and any lost features. State explicitly whether the run was performed or only prepared.