itacart.serialization.geometry_blob.geometry_to_tree

itacart.serialization.geometry_blob.geometry_to_tree(blob)[source]

Derive the TreeBlob of a GeometryBlob’s vertex set.

One-way by construction. The TreeBlob is determined by the set of vertices alone, so distinct sequences, ring topologies, windings and edge models over the same vertices all yield the same TreeBlob. Coverage is preserved, identity is not: a ring and its reverse cover the same ground and arrive here as one tree.

Parameters:

blob (bytes) – A GeometryBlob.

Return type:

bytes

Returns:

The corresponding TreeBlob bytes.

Raises:

MalformedBlobError – If the blob fails structural validation.

Example

>>> blob = encode_geometry([["NE(0625/0451)"]], "POINT", resolution=1)
>>> geometry_to_tree(blob) == encode_tree("NE(0625/0451)")
True