Skip to content

Base

cloudfetch.base.PointCloudProvider

PointCloudProvider(data_dir: Path | str | None = None)

Bases: ABC

Abstract base class for point cloud providers.

Subclasses implement tile discovery for a specific dataset and use this base class for AOI reprojection and PDAL execution.

Parameters:

Name Type Description Default
data_dir Path | str | None

Base directory for cached indices and fetched output. Defaults to ./data in the current working directory.

None

fetch

fetch(
    aoi: Polygon,
    output_path: Path | str | None = None,
    aoi_crs: str = "EPSG:28992",
    sampling_radius: float | None = None,
) -> Path | None

Fetch point cloud data for an area of interest.

Parameters:

Name Type Description Default
aoi Polygon

Area-of-interest geometry to query.

required
output_path Path | str | None

Optional output file path for the resulting COPC file.

None
aoi_crs str

CRS of aoi.

"EPSG:28992"
sampling_radius float | None

Minimum point spacing for Poisson thinning in coordinate units. When provided, fetch applies PDAL filters.sample before writing.

None

Returns:

Type Description
Path | None

Output path if data was fetched, otherwise None when no tiles intersect the AOI.

get_index abstractmethod

get_index(aoi_gdf: GeoDataFrame) -> list[TileRecord]

Returns download URLs intersecting the AOI and their CRS.

Parameters:

Name Type Description Default
aoi_gdf GeoDataFrame

AOI geometry as a GeoDataFrame in the provider CRS.

required

Returns:

Type Description
list[TileRecord]

List of tile records with download URLs and CRS information.

cloudfetch.base.ProviderChain

ProviderChain(
    providers: list[PointCloudProvider],
    data_dir: Path | str | None = None,
)

Bases: PointCloudProvider

Try a sequence of providers until one succeeds.

Parameters:

Name Type Description Default
providers list[PointCloudProvider]

Providers to try in order.

required
data_dir Path | str | None

Base directory for any output written by the chain. Defaults to ./data.

None

fetch

fetch(
    aoi: Polygon,
    output_path: Path | str | None = None,
    aoi_crs: str = "EPSG:28992",
    sampling_radius: float | None = None,
) -> Path | None

Try providers in sequence until one fetch succeeds.

Parameters:

Name Type Description Default
aoi Polygon

Area-of-interest geometry to query.

required
output_path Path | str | None

Optional output file path for the resulting COPC file.

None
aoi_crs str

CRS of aoi.

"EPSG:28992"
sampling_radius float | None

Minimum point spacing for Poisson thinning in coordinate units. Forwarded to child provider fetch calls.

None

Returns:

Type Description
Path | None

Output path of the first successful provider, otherwise None.

cloudfetch.base.AOIPolygon

AOIPolygon(polygon: Polygon, crs: str = 'EPSG:28992')

Polygon wrapper with CRS metadata and file/map helpers.

Parameters:

Name Type Description Default
polygon Polygon

Geometry stored by the wrapper.

required
crs str

Coordinate reference system of polygon.

"EPSG:28992"

get_from_user classmethod

get_from_user(title: str = 'Draw polygon') -> AOIPolygon

Launch a map for the user to draw an AOI polygon.

Parameters:

Name Type Description Default
title str

Window title for the map interface.

"Draw polygon"

Returns:

Type Description
AOIPolygon

An AOIPolygon instance containing the user-drawn geometry in EPSG:4326.

cloudfetch.base.make_map

make_map(title)

Create a Tkinter window for drawing an AOI polygon.

Parameters:

Name Type Description Default
title str

Window title.

required

Returns:

Type Description
tuple[Tk, TkinterMapView, Frame]

Root window, map widget, and controls panel.