itacart.interop.recover_from_geojson

itacart.interop.recover_from_geojson(obj)[source]

Read back the indices that cells_to_geojson() wrote.

This is the recovery path and it is exact: the index is in the file, in the Feature id member, so nothing is inferred from geometry and nothing is lost. It is the inverse that makes the exporter checkable rather than merely plausible.

It refuses rather than returning an empty list. A bare geometry, a single Feature or a collection without features is not something cells_to_geojson() writes – the exporter refuses an empty index, so it never writes an empty collection – and an empty list for any of them would read as a file that recovered to nothing.

Parameters:

obj (dict[str, Any]) – A FeatureCollection produced by cells_to_geojson().

Return type:

list[str]

Returns:

One index per Feature, in file order, never empty.

Raises:

GeometryError – If obj is not a FeatureCollection, if it holds no Feature, or if a Feature carries no recoverable index.