table_ingester#

Processes a single table (layer) from an already-resolved source file into an openplaces entity output file.

Classes#

TableIngester

Processes a single table from an already-resolved source file into an

Module Contents#

class openplaces.io.table_ingester.TableIngester(table_recipe: dict, download_partition: dict, processing_chunk: dict, recipe_heap_dir: pathlib.Path, timer, verbose: bool = False, admin_ids_to_save: list = None)#

Processes a single table from an already-resolved source file into an openplaces entity output file.

Handles reading, preprocessing, and saving one layer or table (a named layer in a GDB or GeoPackage, or the entirety of a single-table file). Does not own download or chunking logic — those belong to the parent Ingester.

Parameters:
  • table_recipe (dict) – Recipe for this specific table. For the primary entity this is the full recipe dict; for additional entities it is the result of build_table_recipe().

  • download_partition (dict) – Shared mutable state from the parent Ingester (data_path, admin_id_to_download, admin_id_crosswalk, table_fids, admin_geometries, etc.). Mutated in place to cache results.

  • processing_chunk (dict) – Mutable dict holding ‘admin_id_to_process’. Shared with Ingester; mutated in place by the tile-partition loop so that TableIngester always sees the current admin unit.

  • recipe_heap_dir (Path) – Heap directory for the primary entity. Used as the unzip target in the compressed-file fallback path of _read_recipe_data.

  • timer (Timer)

  • verbose (bool)

  • admin_ids_to_save (list) – Admin ID strings (or [None]) at the save level. Required only when the recipe uses save_to: admin_level to split output by admin unit.

property table_name: str#

Stable key for this table in per-table caches (e.g. table_fids).

process(process_in_chunks: bool = False, bbox=None)#

Read, preprocess, and save data for this table.

Parameters:
  • process_in_chunks (bool) – If True, filter data to the current processing_chunk[‘admin_id_to_process’].

  • bbox (tuple, optional) – Bounding-box filter (minx, miny, maxx, maxy) used instead of FID-based filtering when process_in_chunks is True.