itacart.serialization.geometry_blob
GeometryBlob: binary encoding of an ordered ITACaRT vertex sequence.
Preserves what TreeBlob discards: vertex order, ring topology, edge model, densification parameters and OGC SFA type. That makes it the form to hash when a geometry must be identified rather than merely covered.
Header layout, 9 bytes:
Byte(s) |
Bits |
Field |
Values |
|---|---|---|---|
|
8 |
Magic |
|
|
8 |
Format version |
|
|
4 |
Canonical profile |
|
|
4 |
Edge model |
|
|
4 |
Densification model |
|
|
4 |
Resolution mode |
|
|
16 |
|
|
|
4 |
Uniform resolution |
|
|
4 |
Geometry type (OGC SFA) |
|
|
16 |
|
1 for single, N for MULTI* |
Components, parts and rings follow, then the vertex stream. Vertices are
delta-encoded by shared_levels, the count of hierarchy levels a vertex
shares with its predecessor; vertex 0 is always written in full.
Density is a curve in the depth of the shared prefix, not a constant. A
vertex sharing nothing with its predecessor costs 65 bits at resolution 13
plus a 4-bit shared_levels field; one sharing all thirteen levels costs
the 4-bit field alone. Measured on a synthetic resolution-13 polygon whose
vertices share levels 1 to 7, the amortised cost is about 25 bits per vertex
for a uniform blob and about 29 for a multi-resolution one, easing towards
those figures as vertex count rises.
Module constants
OGC Simple Feature Access type codes. |
|
Ring roles, written in the high nibble of each part header. |
Functions
Decode a GeometryBlob into rings and profile metadata. |
|
Encode ordered vertex rings as a GeometryBlob. |
|
Content hash of a canonical GeometryBlob. |
|
Derive the TreeBlob of a GeometryBlob's vertex set. |
|
Read the OGC SFA type from the header without full decoding. |
|
Validate blob structure, raising on the first problem found. |