link#
link.py
Entity linking: create ID linkages between two spatial entity datasets.
Functions#
|
Canonical on-disk path of the entity link between two recipes. |
|
Create ID linkage (n-to-m) between two entities and save |
Module Contents#
- openplaces.geo.link.get_entity_link_path(recipe_id_a, recipe_id_b, admin_id=None)#
Canonical on-disk path of the entity link between two recipes.
The link is stored beside the finer entity’s output (
ENTITY_LINK_ORDER, coarse to fine) as<finer_stem>_<coarser_recipe_id>.parquet, so the footprint-parcel link IS the parcel-footprint link: both argument orders resolve to the same path. Entity types outside the ordering and identical entity types fall back to lexicographic recipe-ID order.- Parameters:
recipe_id_a (str) – Recipe IDs of the two linked entities, in any order.
recipe_id_b (str) – Recipe IDs of the two linked entities, in any order.
admin_id (str or AdminId, optional) – Admin unit of the link. Truncated to the owning recipe’s save level to locate its output file, so a county-level admin_id works against a state- or country-level recipe.
- openplaces.geo.link.create_entity_link(entity1_recipe_id, entity2_recipe_id, save=True, **kwargs)#
Create ID linkage (n-to-m) between two entities and save
- Parameters:
entity1_recipe_id (str) – Recipe ID of first entity
entity2_recipe_id (str) – Recipe ID of second entity
save (bool) – If True, save output at the canonical link path resolved by get_entity_link_path (beside the finer entity’s output, regardless of argument order).
kwargs (dict) – Are passed to overlay_polygons or overlay_polygons_with_duckdb. When
how='intersection'(default),iou=False(default), andgeom=False(default), the DuckDB implementation is used because it is faster for Path inputs in that configuration; otherwise geopandas is used.