geo-polygonize 0.43.0 → 0.45.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.
- package/README.md +37 -14
- package/dist/geo_polygonize.wasm +0 -0
- package/dist/geo_polygonize_simd.wasm +0 -0
- package/dist/slim/cjs/bindings/PolygonizerOptions.d.ts +5 -0
- package/dist/slim/cjs/bindings/SnapStrategy.d.ts +1 -1
- package/dist/slim/cjs/bindings/ZOptions.d.ts +8 -0
- package/dist/slim/cjs/bindings/ZPolicy.d.ts +1 -0
- package/dist/slim/cjs/index.d.ts +2 -0
- package/dist/slim/cjs/index_slim.d.ts +2 -0
- package/dist/slim/cjs/index_slim.js +4 -0
- package/dist/slim/cjs/index_threads.d.ts +2 -0
- package/dist/slim/es/bindings/PolygonizerOptions.d.ts +5 -0
- package/dist/slim/es/bindings/SnapStrategy.d.ts +1 -1
- package/dist/slim/es/bindings/ZOptions.d.ts +8 -0
- package/dist/slim/es/bindings/ZPolicy.d.ts +1 -0
- package/dist/slim/es/index.d.ts +2 -0
- package/dist/slim/es/index_slim.d.ts +2 -0
- package/dist/slim/es/index_slim.js +4 -0
- package/dist/slim/es/index_threads.d.ts +2 -0
- package/dist/slim/pkg-wrapper/bindings/PolygonizerOptions.d.ts +5 -0
- package/dist/slim/pkg-wrapper/bindings/SnapStrategy.d.ts +1 -1
- package/dist/slim/pkg-wrapper/bindings/ZOptions.d.ts +8 -0
- package/dist/slim/pkg-wrapper/bindings/ZPolicy.d.ts +1 -0
- package/dist/standard/cjs/bindings/PolygonizerOptions.d.ts +5 -0
- package/dist/standard/cjs/bindings/SnapStrategy.d.ts +1 -1
- package/dist/standard/cjs/bindings/ZOptions.d.ts +8 -0
- package/dist/standard/cjs/bindings/ZPolicy.d.ts +1 -0
- package/dist/standard/cjs/index.d.ts +2 -0
- package/dist/standard/cjs/index.js +6 -2
- package/dist/standard/cjs/index_slim.d.ts +2 -0
- package/dist/standard/cjs/index_threads.d.ts +2 -0
- package/dist/standard/es/bindings/PolygonizerOptions.d.ts +5 -0
- package/dist/standard/es/bindings/SnapStrategy.d.ts +1 -1
- package/dist/standard/es/bindings/ZOptions.d.ts +8 -0
- package/dist/standard/es/bindings/ZPolicy.d.ts +1 -0
- package/dist/standard/es/index.d.ts +2 -0
- package/dist/standard/es/index.js +6 -2
- package/dist/standard/es/index_slim.d.ts +2 -0
- package/dist/standard/es/index_threads.d.ts +2 -0
- package/dist/standard/pkg-wrapper/bindings/PolygonizerOptions.d.ts +5 -0
- package/dist/standard/pkg-wrapper/bindings/SnapStrategy.d.ts +1 -1
- package/dist/standard/pkg-wrapper/bindings/ZOptions.d.ts +8 -0
- package/dist/standard/pkg-wrapper/bindings/ZPolicy.d.ts +1 -0
- package/dist/threads/es/bindings/PolygonizerOptions.d.ts +5 -0
- package/dist/threads/es/bindings/SnapStrategy.d.ts +1 -1
- package/dist/threads/es/bindings/ZOptions.d.ts +8 -0
- package/dist/threads/es/bindings/ZPolicy.d.ts +1 -0
- package/dist/threads/es/index.d.ts +2 -0
- package/dist/threads/es/index.js +4 -0
- package/dist/threads/es/index_slim.d.ts +2 -0
- package/dist/threads/es/index_threads.d.ts +2 -0
- package/dist/threads/pkg-wrapper/bindings/PolygonizerOptions.d.ts +5 -0
- package/dist/threads/pkg-wrapper/bindings/SnapStrategy.d.ts +1 -1
- package/dist/threads/pkg-wrapper/bindings/ZOptions.d.ts +8 -0
- package/dist/threads/pkg-wrapper/bindings/ZPolicy.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,27 +24,37 @@ For an ambitious, prioritized plan covering performance, security, API consisten
|
|
|
24
24
|
### Library
|
|
25
25
|
|
|
26
26
|
```rust
|
|
27
|
-
use geo_polygonize_core::{
|
|
28
|
-
use
|
|
27
|
+
use geo_polygonize_core::{polygonize_line_strings, PolygonizerOptions};
|
|
28
|
+
use geo_types::LineString;
|
|
29
29
|
|
|
30
30
|
fn main() {
|
|
31
|
-
let
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
let result =
|
|
31
|
+
let ring = LineString::from(vec![
|
|
32
|
+
(0.0, 0.0),
|
|
33
|
+
(10.0, 0.0),
|
|
34
|
+
(10.0, 10.0),
|
|
35
|
+
(0.0, 10.0),
|
|
36
|
+
(0.0, 0.0),
|
|
37
|
+
]);
|
|
38
|
+
|
|
39
|
+
let result = polygonize_line_strings([&ring], &PolygonizerOptions::default())
|
|
40
40
|
.expect("Polygonization failed");
|
|
41
|
+
let polygons = result.into_multi_polygon();
|
|
41
42
|
|
|
42
|
-
for polygon in
|
|
43
|
-
println!("Found polygon
|
|
43
|
+
for polygon in polygons {
|
|
44
|
+
println!("Found polygon: {polygon:?}");
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
```
|
|
47
48
|
|
|
49
|
+
`polygonize_line_strings` accepts owned or borrowed `geo_traits::LineStringTrait`
|
|
50
|
+
values. Use `polygonize` when source IDs or Z values must be supplied explicitly,
|
|
51
|
+
and keep its full result when dangles, cut edges, invalid rings, or diagnostics are
|
|
52
|
+
needed.
|
|
53
|
+
|
|
54
|
+
Rust consumers should import the supported facade from the crate root. Graph,
|
|
55
|
+
noding, containment, utility, mutable-builder, and tiled APIs are internal or
|
|
56
|
+
experimental and may change without compatibility guarantees before `1.0`.
|
|
57
|
+
|
|
48
58
|
### Choosing noding and precision
|
|
49
59
|
|
|
50
60
|
Polygonization quality is heavily influenced by input noding strategy.
|
|
@@ -70,6 +80,19 @@ Use `NodingGuarantee::CertifiedFixedPrecision` with `node_input`, `FixedGrid`,
|
|
|
70
80
|
the `Snap` backend, and `SnapStrategy::Grid` for hot-pixel snap rounding plus
|
|
71
81
|
that validation. Certified coordinates must fit exact integer grid indices.
|
|
72
82
|
|
|
83
|
+
### Z semantics
|
|
84
|
+
|
|
85
|
+
Topology is always computed in XY. `ZPolicy::InterpolateAlongEdge` is the
|
|
86
|
+
default and reconstructs split-vertex Z on each source edge;
|
|
87
|
+
`PreferNearestEndpoint` uses the nearer endpoint, and `Ignore` emits zero Z.
|
|
88
|
+
When several source edges meet at the same XY node, the graph chooses the Z
|
|
89
|
+
from the lowest line ID (then the lowest Z) and reports conflicts through
|
|
90
|
+
diagnostics. `ErrorOnConflict` instead returns a typed error when the difference
|
|
91
|
+
exceeds `z.conflict_tolerance`.
|
|
92
|
+
|
|
93
|
+
Use `Line3D` or the Python/Wasm typed-buffer APIs with `stride=3` for Z-aware
|
|
94
|
+
processing. The GeoRust, GeoJSON, and current GeoArrow adapters are XY-only.
|
|
95
|
+
|
|
73
96
|
### Output semantics
|
|
74
97
|
|
|
75
98
|
The polygonizer intentionally returns only valid polygonal areas that can be formed from closed cycles:
|
|
@@ -155,7 +178,7 @@ are dissolved into one topology edge while every contributing nonzero
|
|
|
155
178
|
|
|
156
179
|
`SnapStrategy::Grid` keeps topology and output coordinates on a configured
|
|
157
180
|
fixed precision grid. The CFB profile uses `GeosCompat`: the grid establishes robust
|
|
158
|
-
topology, then output nodes regain deterministic source coordinates to better
|
|
181
|
+
topology, then output nodes regain deterministic source XY coordinates to better
|
|
159
182
|
match Shapely `snap` plus full-precision noding. It is not `set_precision`
|
|
160
183
|
emulation, and exact parity is not guaranteed for many-to-one snaps.
|
|
161
184
|
|
package/dist/geo_polygonize.wasm
CHANGED
|
Binary file
|
|
Binary file
|
|
@@ -6,6 +6,7 @@ import type { OutputFilterOptions } from "./OutputFilterOptions";
|
|
|
6
6
|
import type { PrecisionModel } from "./PrecisionModel";
|
|
7
7
|
import type { ProvenanceOptions } from "./ProvenanceOptions";
|
|
8
8
|
import type { SnapStrategy } from "./SnapStrategy";
|
|
9
|
+
import type { ZOptions } from "./ZOptions";
|
|
9
10
|
/**
|
|
10
11
|
* The canonical configuration object for the `geo-polygonize` engine.
|
|
11
12
|
*
|
|
@@ -77,6 +78,10 @@ export type PolygonizerOptions = {
|
|
|
77
78
|
* Options for mapping final faces back to original input geometry IDs.
|
|
78
79
|
*/
|
|
79
80
|
provenance: ProvenanceOptions;
|
|
81
|
+
/**
|
|
82
|
+
* Controls Z reconstruction and same-XY conflict handling.
|
|
83
|
+
*/
|
|
84
|
+
z: ZOptions;
|
|
80
85
|
/**
|
|
81
86
|
* Optional application-level filtering applied after topology is established.
|
|
82
87
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Strategy for robust snap noding and output coordinates.
|
|
3
3
|
*
|
|
4
4
|
* `Grid` uses the precision grid for both topology and output coordinates.
|
|
5
|
-
* `GeosCompat` uses the grid for topology, then restores one deterministic nearest source
|
|
5
|
+
* `GeosCompat` uses the grid for topology, then restores one deterministic nearest source XY
|
|
6
6
|
* coordinate per snapped node. This targets Shapely-style `snap` followed by full-precision
|
|
7
7
|
* noding and polygonization; it does not emulate `set_precision` output.
|
|
8
8
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ZPolicy = "Ignore" | "InterpolateAlongEdge" | "PreferNearestEndpoint" | "ErrorOnConflict";
|
package/dist/slim/cjs/index.d.ts
CHANGED
|
@@ -13,5 +13,7 @@ export * from "./bindings/ProvenanceOptions";
|
|
|
13
13
|
export * from "./bindings/SnapStrategy";
|
|
14
14
|
export * from "./bindings/TileOwnershipPolicy";
|
|
15
15
|
export * from "./bindings/TouchPolicy";
|
|
16
|
+
export * from "./bindings/ZOptions";
|
|
17
|
+
export * from "./bindings/ZPolicy";
|
|
16
18
|
export * from "./cfb";
|
|
17
19
|
export default function init(_input?: any): Promise<typeof exports>;
|
|
@@ -13,5 +13,7 @@ export * from "./bindings/ProvenanceOptions";
|
|
|
13
13
|
export * from "./bindings/SnapStrategy";
|
|
14
14
|
export * from "./bindings/TileOwnershipPolicy";
|
|
15
15
|
export * from "./bindings/TouchPolicy";
|
|
16
|
+
export * from "./bindings/ZOptions";
|
|
17
|
+
export * from "./bindings/ZPolicy";
|
|
16
18
|
export * from "./cfb";
|
|
17
19
|
export declare function initBest(scalarModule: any, simdModule?: any): Promise<typeof scalarExports>;
|
|
@@ -13,5 +13,7 @@ export * from "./bindings/ProvenanceOptions";
|
|
|
13
13
|
export * from "./bindings/SnapStrategy";
|
|
14
14
|
export * from "./bindings/TileOwnershipPolicy";
|
|
15
15
|
export * from "./bindings/TouchPolicy";
|
|
16
|
+
export * from "./bindings/ZOptions";
|
|
17
|
+
export * from "./bindings/ZPolicy";
|
|
16
18
|
export * from "./cfb";
|
|
17
19
|
export default init;
|
|
@@ -6,6 +6,7 @@ import type { OutputFilterOptions } from "./OutputFilterOptions";
|
|
|
6
6
|
import type { PrecisionModel } from "./PrecisionModel";
|
|
7
7
|
import type { ProvenanceOptions } from "./ProvenanceOptions";
|
|
8
8
|
import type { SnapStrategy } from "./SnapStrategy";
|
|
9
|
+
import type { ZOptions } from "./ZOptions";
|
|
9
10
|
/**
|
|
10
11
|
* The canonical configuration object for the `geo-polygonize` engine.
|
|
11
12
|
*
|
|
@@ -77,6 +78,10 @@ export type PolygonizerOptions = {
|
|
|
77
78
|
* Options for mapping final faces back to original input geometry IDs.
|
|
78
79
|
*/
|
|
79
80
|
provenance: ProvenanceOptions;
|
|
81
|
+
/**
|
|
82
|
+
* Controls Z reconstruction and same-XY conflict handling.
|
|
83
|
+
*/
|
|
84
|
+
z: ZOptions;
|
|
80
85
|
/**
|
|
81
86
|
* Optional application-level filtering applied after topology is established.
|
|
82
87
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Strategy for robust snap noding and output coordinates.
|
|
3
3
|
*
|
|
4
4
|
* `Grid` uses the precision grid for both topology and output coordinates.
|
|
5
|
-
* `GeosCompat` uses the grid for topology, then restores one deterministic nearest source
|
|
5
|
+
* `GeosCompat` uses the grid for topology, then restores one deterministic nearest source XY
|
|
6
6
|
* coordinate per snapped node. This targets Shapely-style `snap` followed by full-precision
|
|
7
7
|
* noding and polygonization; it does not emulate `set_precision` output.
|
|
8
8
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ZPolicy = "Ignore" | "InterpolateAlongEdge" | "PreferNearestEndpoint" | "ErrorOnConflict";
|
package/dist/slim/es/index.d.ts
CHANGED
|
@@ -13,5 +13,7 @@ export * from "./bindings/ProvenanceOptions";
|
|
|
13
13
|
export * from "./bindings/SnapStrategy";
|
|
14
14
|
export * from "./bindings/TileOwnershipPolicy";
|
|
15
15
|
export * from "./bindings/TouchPolicy";
|
|
16
|
+
export * from "./bindings/ZOptions";
|
|
17
|
+
export * from "./bindings/ZPolicy";
|
|
16
18
|
export * from "./cfb";
|
|
17
19
|
export default function init(_input?: any): Promise<typeof exports>;
|
|
@@ -13,5 +13,7 @@ export * from "./bindings/ProvenanceOptions";
|
|
|
13
13
|
export * from "./bindings/SnapStrategy";
|
|
14
14
|
export * from "./bindings/TileOwnershipPolicy";
|
|
15
15
|
export * from "./bindings/TouchPolicy";
|
|
16
|
+
export * from "./bindings/ZOptions";
|
|
17
|
+
export * from "./bindings/ZPolicy";
|
|
16
18
|
export * from "./cfb";
|
|
17
19
|
export declare function initBest(scalarModule: any, simdModule?: any): Promise<typeof scalarExports>;
|
|
@@ -13,5 +13,7 @@ export * from "./bindings/ProvenanceOptions";
|
|
|
13
13
|
export * from "./bindings/SnapStrategy";
|
|
14
14
|
export * from "./bindings/TileOwnershipPolicy";
|
|
15
15
|
export * from "./bindings/TouchPolicy";
|
|
16
|
+
export * from "./bindings/ZOptions";
|
|
17
|
+
export * from "./bindings/ZPolicy";
|
|
16
18
|
export * from "./cfb";
|
|
17
19
|
export default init;
|
|
@@ -6,6 +6,7 @@ import type { OutputFilterOptions } from "./OutputFilterOptions";
|
|
|
6
6
|
import type { PrecisionModel } from "./PrecisionModel";
|
|
7
7
|
import type { ProvenanceOptions } from "./ProvenanceOptions";
|
|
8
8
|
import type { SnapStrategy } from "./SnapStrategy";
|
|
9
|
+
import type { ZOptions } from "./ZOptions";
|
|
9
10
|
/**
|
|
10
11
|
* The canonical configuration object for the `geo-polygonize` engine.
|
|
11
12
|
*
|
|
@@ -77,6 +78,10 @@ export type PolygonizerOptions = {
|
|
|
77
78
|
* Options for mapping final faces back to original input geometry IDs.
|
|
78
79
|
*/
|
|
79
80
|
provenance: ProvenanceOptions;
|
|
81
|
+
/**
|
|
82
|
+
* Controls Z reconstruction and same-XY conflict handling.
|
|
83
|
+
*/
|
|
84
|
+
z: ZOptions;
|
|
80
85
|
/**
|
|
81
86
|
* Optional application-level filtering applied after topology is established.
|
|
82
87
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Strategy for robust snap noding and output coordinates.
|
|
3
3
|
*
|
|
4
4
|
* `Grid` uses the precision grid for both topology and output coordinates.
|
|
5
|
-
* `GeosCompat` uses the grid for topology, then restores one deterministic nearest source
|
|
5
|
+
* `GeosCompat` uses the grid for topology, then restores one deterministic nearest source XY
|
|
6
6
|
* coordinate per snapped node. This targets Shapely-style `snap` followed by full-precision
|
|
7
7
|
* noding and polygonization; it does not emulate `set_precision` output.
|
|
8
8
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ZPolicy = "Ignore" | "InterpolateAlongEdge" | "PreferNearestEndpoint" | "ErrorOnConflict";
|
|
@@ -6,6 +6,7 @@ import type { OutputFilterOptions } from "./OutputFilterOptions";
|
|
|
6
6
|
import type { PrecisionModel } from "./PrecisionModel";
|
|
7
7
|
import type { ProvenanceOptions } from "./ProvenanceOptions";
|
|
8
8
|
import type { SnapStrategy } from "./SnapStrategy";
|
|
9
|
+
import type { ZOptions } from "./ZOptions";
|
|
9
10
|
/**
|
|
10
11
|
* The canonical configuration object for the `geo-polygonize` engine.
|
|
11
12
|
*
|
|
@@ -77,6 +78,10 @@ export type PolygonizerOptions = {
|
|
|
77
78
|
* Options for mapping final faces back to original input geometry IDs.
|
|
78
79
|
*/
|
|
79
80
|
provenance: ProvenanceOptions;
|
|
81
|
+
/**
|
|
82
|
+
* Controls Z reconstruction and same-XY conflict handling.
|
|
83
|
+
*/
|
|
84
|
+
z: ZOptions;
|
|
80
85
|
/**
|
|
81
86
|
* Optional application-level filtering applied after topology is established.
|
|
82
87
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Strategy for robust snap noding and output coordinates.
|
|
3
3
|
*
|
|
4
4
|
* `Grid` uses the precision grid for both topology and output coordinates.
|
|
5
|
-
* `GeosCompat` uses the grid for topology, then restores one deterministic nearest source
|
|
5
|
+
* `GeosCompat` uses the grid for topology, then restores one deterministic nearest source XY
|
|
6
6
|
* coordinate per snapped node. This targets Shapely-style `snap` followed by full-precision
|
|
7
7
|
* noding and polygonization; it does not emulate `set_precision` output.
|
|
8
8
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ZPolicy = "Ignore" | "InterpolateAlongEdge" | "PreferNearestEndpoint" | "ErrorOnConflict";
|
|
@@ -13,5 +13,7 @@ export * from "./bindings/ProvenanceOptions";
|
|
|
13
13
|
export * from "./bindings/SnapStrategy";
|
|
14
14
|
export * from "./bindings/TileOwnershipPolicy";
|
|
15
15
|
export * from "./bindings/TouchPolicy";
|
|
16
|
+
export * from "./bindings/ZOptions";
|
|
17
|
+
export * from "./bindings/ZPolicy";
|
|
16
18
|
export * from "./cfb";
|
|
17
19
|
export default function init(_input?: any): Promise<typeof exports>;
|