Skip to content

intersection

intersect_nodes_with_geometry(
    tmp_dir_path, geometry_filter, progress_bar=None
)

Intersects nodes points with geometry filter using spatial index with multiprocessing.

PARAMETER DESCRIPTION
tmp_dir_path

Path of the working directory.

TYPE: Path

geometry_filter

Geometry used for filtering.

TYPE: BaseGeometry

progress_bar

Progress bar to show task status. Defaults to None

TYPE: Optional[TaskProgressBar] DEFAULT: None

Source code in quackosm/_intersection.py
def intersect_nodes_with_geometry(
    tmp_dir_path: Path,
    geometry_filter: BaseGeometry,
    progress_bar: Optional[TaskProgressBar] = None,
) -> None:
    """
    Intersects nodes points with geometry filter using spatial index with multiprocessing.

    Args:
        tmp_dir_path (Path): Path of the working directory.
        geometry_filter (BaseGeometry): Geometry used for filtering.
        progress_bar (Optional[TaskProgressBar]): Progress bar to show task status.
            Defaults to `None`
    """
    dataset_path = tmp_dir_path / "nodes_valid_with_tags"
    destination_path = tmp_dir_path / "nodes_intersecting_ids"

    map_parquet_dataset(
        dataset_path=dataset_path,
        destination_path=destination_path,
        progress_bar=progress_bar,
        function=partial(_intersect_nodes, geometry_filter=geometry_filter),
        columns=["id", "lat", "lon"],
    )