get_sub_grids
get_sub_grids ¶
get_sub_grids(
coordinates: List[Tuple[int, int, int, int]],
inds: Tuple[int, ...] = None,
min_size: int = 1,
return_gdf: bool = False,
) -> List[List[Tuple[int, int, int, int]]]
Get sub-grids based on connected components of the grid.
Note
The order of the sub-grids is from ymin to ymax.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coordinates
|
List[Tuple[int, int, int, int]]
|
List of grid bbox coordinates in (x, y, w, h) format. |
required |
inds
|
Tuple[int, ...], default=None
|
Indices of the connected components to extract. |
None
|
min_size
|
int
|
Minimum size of the sub grid. |
1
|
return_gdf
|
bool
|
Whether to return a GeoDataFrame instead of a list of sub-grids. |
False
|
Returns:
| Type | Description |
|---|---|
List[List[Tuple[int, int, int, int]]]
|
List[List[Tuple[int, int, int, int]]]: Nested list of sub-grids in (x, y, w, h) format. |