geo-polygonize 0.23.1 → 0.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
Binary file
@@ -7,18 +7,86 @@ import type { SnapStrategy } from "./SnapStrategy";
7
7
  import type { TargetProfile } from "./TargetProfile";
8
8
  import type { TilingOptions } from "./TilingOptions";
9
9
  import type { ZOptions } from "./ZOptions";
10
+ /**
11
+ * The canonical configuration object for the `geo-polygonize` engine.
12
+ *
13
+ * This struct controls every aspect of the polygonization pipeline, including
14
+ * topological robustness, feature output, containment policies, noding, and determinism.
15
+ */
10
16
  export type PolygonizerOptions = {
17
+ /**
18
+ * Determines the execution environment profile (e.g., Native, WasmSingleThread, WasmThreads).
19
+ *
20
+ * Default: `TargetProfile::Native`
21
+ */
11
22
  target: TargetProfile;
23
+ /**
24
+ * Whether to robustly node the input before polygonization.
25
+ *
26
+ * Enable this for real-world linework where segment intersections may not
27
+ * already exist as explicit vertices. This is slower than the fast path but
28
+ * avoids missing faces and unresolved crossings.
29
+ *
30
+ * Default: `false`
31
+ */
12
32
  node_input: boolean;
33
+ /**
34
+ * The snapping grid size used for vertex deduplication and noding operations.
35
+ *
36
+ * Vertices falling within the same grid cell are coalesced. A size of `0.0`
37
+ * indicates exact floating-point evaluation without grid snapping.
38
+ *
39
+ * Default: `1e-10`
40
+ */
13
41
  snap_grid_size: number;
42
+ /**
43
+ * If `true`, only pure, outermost polygonal shells are returned.
44
+ *
45
+ * Floating dangles, internal cut-lines, or invalid rings will be discarded.
46
+ *
47
+ * Default: `false`
48
+ */
14
49
  extract_only_polygonal: boolean;
50
+ /**
51
+ * The underlying strategy to apply when snapping coordinate geometries.
52
+ *
53
+ * See `SnapStrategy` for differences between strict `Grid` snapping and
54
+ * Shapely/GEOS `GeosCompat` strategies.
55
+ *
56
+ * Default: `SnapStrategy::Grid`
57
+ */
15
58
  snap_strategy: SnapStrategy;
59
+ /**
60
+ * Configures the noding engine backend and behavior.
61
+ */
16
62
  noding: NodingOptions;
63
+ /**
64
+ * Configures how topological relationships (containment) are calculated
65
+ * during face formation.
66
+ */
17
67
  containment: ContainmentOptions;
68
+ /**
69
+ * Optional configuration for tiled, distributed execution across huge datasets.
70
+ */
18
71
  tiling?: TilingOptions;
72
+ /**
73
+ * Configures Z-axis coordinate handling.
74
+ */
19
75
  z: ZOptions;
76
+ /**
77
+ * Configuration for enforcing exact topological determinism.
78
+ */
20
79
  determinism: DeterminismOptions;
80
+ /**
81
+ * Options for capturing diagnostic topology failures.
82
+ */
21
83
  diagnostics: DiagnosticsOptions;
84
+ /**
85
+ * Options for mapping final faces back to original input geometry IDs.
86
+ */
22
87
  provenance: ProvenanceOptions;
88
+ /**
89
+ * An optional identifier for the input dataset.
90
+ */
23
91
  input_profile_id?: string;
24
92
  };
@@ -1 +1,25 @@
1
+ /**
2
+ * Strategy for snapping coordinates to a grid.
3
+ *
4
+ * `Grid` applies a standard round-to-nearest integer grid policy `(coord / size).round() * size`.
5
+ * `GeosCompat` attempts to emulate GEOS / Shapely's `set_precision` behavior, which uses
6
+ * C++ std::round (rounding halfway cases away from zero).
7
+ *
8
+ * **Scale Guidance:**
9
+ * Use `Grid` for native Rust applications where absolute topological determinism and
10
+ * intuitive rounding is preferred.
11
+ * Use `GeosCompat` if you are using `geo-polygonize` to replace a Shapely / GEOS pipeline
12
+ * and require exact parity for edge cases at precision boundaries.
13
+ *
14
+ * **Expected Parity:**
15
+ * Rust's native `f64::round()` rounds halfway cases away from zero. This perfectly
16
+ * matches C++ `std::round` behavior, meaning that `Grid` and `GeosCompat` currently
17
+ * map identical values for basic single-coordinate precision points (e.g., `-0.5` => `-1.0`
18
+ * and `0.5` => `1.0`).
19
+ *
20
+ * **Expected Divergence:**
21
+ * The divergence between `Grid` and `GeosCompat` strategies typically arises under complex
22
+ * topological scaling sequences rather than simple single point coordinate rounding, but
23
+ * the option ensures the library remains semantically compatible with Python/C++ GEOS pipelines.
24
+ */
1
25
  export type SnapStrategy = "Grid" | "GeosCompat";