Skip to content

geoparquet

rustac.GeoparquetWriter

A helper class to write geoparquet from batches of items.

finish async

finish() -> None

Finishes writing the stac-geoparquet file.

open async staticmethod

open(
    items: list[dict[str, Any]],
    path: str,
    drop_invalid_attributes: bool = True,
    store: AnyObjectStore | None = None,
) -> GeoparquetWriter

Creates a new writer for the provided items and the path.

Parameters:

  • items (list[dict[str, Any]]) –

    The STAC items to write to geoparquet. The schema of these items will be used for the output file, and any additional items added to the writer need to have the same schema.

  • path (str) –

    The filesystem path to write the stac-geoparquet to.

  • drop_invalid_attributes (bool, default: True ) –

    Whether to drop invalid attributes in the items' properties (e.g. an additional id property). If false, raise an error instead.

  • store (AnyObjectStore | None, default: None ) –

    The object store to use for the geoparquet file. If not provided, a local object store will be used.

write async

write(items: list[dict[str, Any]]) -> None

Writes more items to the geoparquet.

Parameters:

  • items (list[dict[str, Any]]) –

    The items to write. They must have the same schema as the items used to initialize the writer.

rustac.geoparquet_writer async

geoparquet_writer(
    items: list[dict[str, Any]],
    path: str,
    drop_invalid_attributes: bool = True,
    store=None,
) -> AsyncGenerator[GeoparquetWriter]

Open a geoparquet writer in a context manager.

The items provided to the initial call will be used to build the geoparquet schema. All subsequent items must have the same schema.

The underlying parquet writer will group batches of items into row groups based upon it's default configuration; the row groups are not determined by the size of the item lists passed to the writer.

Parameters:

  • items (list[dict[str, Any]]) –

    The STAC items

  • path (str) –

    The path for the stac-geoparquet file

  • drop_invalid_attributes (bool, default: True ) –

    If true, invalid attributes (e.g. an id in the properties field) will be dropped. If false, raise an error if an invalid attribute is encountered.

  • store

    The optional object store to use for writing the geoparquet file.

Examples:

>>> async with geoparquet_writer(item_batches[0], "out.parquet") as w:
...     for items in item_batches[1:]:
...         await w.write(items)
...
>>>