H3Neighbourhood
¶
Bases: Neighbourhood[str]
H3 Neighbourhood.
This class allows to get the neighbours of an H3 region.
If a regions GeoDataFrame is provided, only the neighbours that are in the regions GeoDataFrame will be returned by the methods of this instance.
If a region is a part of the k-th ring of a region
and is included in the GeoDataFrame, it will be returned by get_neighbours_at_distance method with distance k even when there is no path of length k between the two regions.
PARAMETER | DESCRIPTION |
---|---|
regions_gdf |
The regions that are being analyzed. The H3Neighbourhood will only look for neighbours among these regions. Defaults to None.
TYPE:
|
include_center |
Whether to include the region itself in the neighbours.
TYPE:
|
Source code in srai/neighbourhoods/h3_neighbourhood.py
¶
Get the direct neighbours of an H3 region using its index.
PARAMETER | DESCRIPTION |
---|---|
index |
H3 index of the region.
TYPE:
|
include_center |
Whether to include the region itself in the neighbours.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
set[str]
|
Set[str]: Indexes of the neighbours. |
Source code in srai/neighbourhoods/h3_neighbourhood.py
¶
Get the neighbours of an H3 region up to a certain distance.
PARAMETER | DESCRIPTION |
---|---|
index |
H3 index of the region.
TYPE:
|
distance |
Distance to the neighbours.
TYPE:
|
include_center |
Whether to include the region itself in the neighbours. If None, the value set in init is used. Defaults to None.
TYPE:
|
unchecked |
Whether to check if the neighbours are in the available indices.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
set[str]
|
Set[str]: Indexes of the neighbours up to the given distance. |
Source code in srai/neighbourhoods/h3_neighbourhood.py
¶
Get the neighbours of an H3 region at a certain distance.
PARAMETER | DESCRIPTION |
---|---|
index |
H3 index of the region.
TYPE:
|
distance |
Distance to the neighbours.
TYPE:
|
include_center |
Whether to include the region itself in the neighbours.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
set[str]
|
Set[str]: Indexes of the neighbours at the given distance. |