itacart.serialization.geometry_blob.geometry_hash

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

Content hash of a canonical GeometryBlob.

Meaningful only for canonicalised blobs: without canonicalisation the same geometry written from a different starting vertex hashes differently.

Canonicalisation covers the starting vertex and nothing else, so a ring and its reverse are two geometries and hash apart. That is the intended reading: direction is meaning, not spelling.

Parameters:

blob (bytes) – The binary blob.

Return type:

bytes

Returns:

A 32-byte digest.

Example

>>> blob = encode_geometry([["NE(0625/0451)"]], "POINT", resolution=1)
>>> len(geometry_hash(blob))
32