Point Clusterization¶
Clusterization groups nearby points into polygons based on spatial proximity and minimum cluster size.
It can be used for identifying dense urban areas, service hubs, or catchment zones.
Cluster Generation¶
Clusters are generated using spatial rules:
- Minimum distance between points to be included in the same cluster.
- Minimum number of points required to form a valid cluster.
objectnat.get_clusters_polygon(points, min_dist=100, min_point=5, method='HDBSCAN', service_code_column='service_code')
¶Generate cluster polygons for given points based on a specified minimum distance and minimum points per cluster. Optionally, calculate the relative ratio between types of points within the clusters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
points
|
GeoDataFrame
|
GeoDataFrame containing the points to be clustered. Must include a 'service_code' column for service ratio calculations. |
required |
min_dist
|
float | int
|
Minimum distance between points to be considered part of the same cluster. Defaults to 100. |
100
|
min_point
|
int
|
Minimum number of points required to form a cluster. Defaults to 5. |
5
|
method
|
Literal['DBSCAN', 'HDBSCAN']
|
The clustering method to use. Must be either "DBSCAN" or "HDBSCAN". Defaults to "HDBSCAN". |
'HDBSCAN'
|
service_code_column
|
str
|
Column, containing service type for relative ratio in clasterized polygons. Defaults to "service_code". |
'service_code'
|
Returns:
Type | Description |
---|---|
tuple[GeoDataFrame, GeoDataFrame]
|
A tuple containing the clustered polygons GeoDataFrame and the original points GeoDataFrame with cluster labels. |
Source code in src\objectnat\methods\point_clustering\cluster_points_in_polygons.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
|