API Reference
objectnat
¶
ObjectNat is an open-source library created for geospatial analysis created by IDU team.
Homepage https://github.com/DDonnyy/ObjectNat.
calculate_simplified_noise_frame(noise_sources: gpd.GeoDataFrame, obstacles: gpd.GeoDataFrame, air_temperature, **kwargs) -> gpd.GeoDataFrame
¶
Calculates a simplified environmental noise frame using static noise source geometries without simulating full sound wave propagation or reflections.
This function provides a fast approximation of noise dispersion from a variety of source geometries, including points (e.g., traffic noise measurement points), lines (e.g., roads or railways), and polygons (e.g., industrial zones or buildings). Instead of simulating detailed wave interactions and reflections, it constructs an envelope of potential noise exposure by buffering the source geometry and applying simplified decay formulas based on sound power, frequency and temperature.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
noise_sources
|
GeoDataFrame
|
A GeoDataFrame containing geometries of noise sources (Point, LineString, or Polygon). Each feature must have the following two columns: - 'source_noise_db': Initial sound level at the source, in decibels (dB). - 'geometric_mean_freq_hz': Characteristic sound frequency (Hz) used to model distance-based attenuation. Values in 'source_noise_db' must not exceed the physical maximum of 194 dB. Missing or NaN values in required fields will raise an error. |
required |
obstacles
|
GeoDataFrame
|
A GeoDataFrame representing physical obstructions in the environment (e.g., buildings, walls, terrain). These are used to build visibility masks that affect where sound can propagate. Geometry will be simplified for performance using a default tolerance of 1 unit. |
required |
air_temperature
|
float
|
The ambient air temperature in degrees Celsius. This value influences the attenuation model of sound in the atmosphere. Temperatures significantly outside the typical 0–30°C range may lead to inaccurate results. |
required |
Optional kwargs
- target_noise_db (float, optional): The minimum sound level threshold (in dB) to be modeled. Any value below this threshold is considered insignificant and will be excluded from the resulting noise frame. Default is 40 dB.
- db_sim_step (float, optional): The simulation step size (in dB) used to discretize sound levels into spatial layers. Default is 5. Smaller values produce more detailed output but increase computation time.
- linestring_point_radius (float, optional): The spacing radius (in meters) used when converting LineString geometries into distributed point sources for simulation. Default is 30. Reducing this value improves detail along long lines.
- polygon_point_radius (float, optional): The point spacing (in meters) for distributing sources within Polygon geometries. Default is 15. Points are sampled across the polygon’s surface and perimeter to represent the full sound-emitting area.
Returns:
Type | Description |
---|---|
GeoDataFrame
|
A GeoDataFrame representing simplified noise distribution areas. The output geometries are polygons where each polygon is associated with the maximum sound level (in dB) present in that area, as derived from overlapping source zones. The resulting data is dissolved by noise level and returned in the original coordinate reference system (CRS) of the input sources. |
Notes
- The function does not model reflections or complex diffraction effects. It uses straight-line visibility (line-of-sight) and a layered distance-decay approach for rapid estimation.
- Obstacles are used for visibility masking only, not as reflectors or absorbers.
- Output resolution and accuracy depend heavily on the geometry type and point distribution settings.
- Results are useful for quick noise mapping or for generating initial noise envelopes prior to more detailed simulations.
Source code in src\objectnat\methods\noise\noise_simulation_simplified.py
18 19 20 21 22 23 24 25 26 27 28 29 30 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 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
|
calculate_visibility_catchment_area(points: gpd.GeoDataFrame, obstacles: gpd.GeoDataFrame, view_distance: int | float, max_workers: int = cpu_count()) -> gpd.GeoDataFrame
¶
Calculate visibility catchment areas for a large urban area based on given points and obstacles. This function is designed to work with at least 1000 points spaced 10-20 meters apart for optimal results. Points can be generated using a road graph.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
points
|
GeoDataFrame
|
GeoDataFrame containing the points from which visibility is calculated. |
required |
obstacles
|
GeoDataFrame
|
GeoDataFrame containing the obstacles that block visibility. |
required |
view_distance
|
int | float
|
The maximum distance from each point within which visibility is calculated. |
required |
max_workers
|
int
|
Maximum workers in multiproccesing, multipocessing.cpu_count() by default. |
cpu_count()
|
Returns:
Type | Description |
---|---|
GeoDataFrame
|
GeoDataFrame containing the calculated visibility catchment areas. |
Source code in src\objectnat\methods\visibility\visibility_analysis.py
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 |
|
gdf_to_graph(gdf: gpd.GeoDataFrame, project_gdf_attr=True, reproject_to_utm_crs=True, speed=5, check_intersections=True) -> nx.DiGraph
¶
Converts a GeoDataFrame of LineStrings into a directed graph (nx.DiGraph).
This function transforms a set of linear geometries (which may or may not form a planar graph) into a directed graph where each edge corresponds to a LineString (or its segment) from the GeoDataFrame. Intersections are optionally checked and merged. Attributes from the original GeoDataFrame can be projected onto the graph edges using spatial matching.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gdf
|
GeoDataFrame
|
A GeoDataFrame containing at least one LineString geometry. |
required |
project_gdf_attr
|
bool
|
If True, attributes from the input GeoDataFrame will be spatially projected onto the resulting graph edges. This can be an expensive operation for large datasets. |
True
|
reproject_to_utm_crs
|
bool
|
If True, reprojects the GeoDataFrame to the estimated local UTM CRS to ensure accurate edge length calculations in meters. If False, edge lengths are still computed in UTM CRS, but the final graph will remain in the original CRS of the input GeoDataFrame. |
True
|
speed
|
float
|
Assumed travel speed in km/h used to compute edge traversal time (in minutes). |
5
|
check_intersections
|
bool
|
If True, merges geometries to ensure topological correctness. Can be disabled if the input geometries already form a proper planar graph with no unintended intersections. |
True
|
Returns:
Type | Description |
---|---|
DiGraph
|
A directed graph where each edge corresponds to a line segment from the input GeoDataFrame. Edge attributes include geometry, length in meters, travel time (in minutes), and any additional projected attributes from the original GeoDataFrame. |
Raises:
Type | Description |
---|---|
ValueError
|
If the input GeoDataFrame contains no valid LineStrings. |
Source code in src\objectnat\methods\utils\graph_utils.py
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 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
|
get_accessibility_isochrone_stepped(isochrone_type: Literal['radius', 'ways', 'separate'], point: gpd.GeoDataFrame, weight_value: float, weight_type: Literal['time_min', 'length_meter'], nx_graph: nx.Graph, step: float = None, **kwargs: Any) -> tuple[gpd.GeoDataFrame, gpd.GeoDataFrame | None, gpd.GeoDataFrame | None]
¶
Calculate stepped accessibility isochrones for a single point with specified intervals.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
isochrone_type
|
Literal['radius', 'ways', 'separate']
|
Visualization method for stepped isochrones: - "radius": Voronoi-based in circular buffers - "ways": Voronoi-based in road network polygons - "separate": Circular buffers for each step |
required |
point
|
GeoDataFrame
|
Single source point for isochrone calculation (uses first geometry if multiple provided). |
required |
weight_value
|
float
|
Maximum travel time (minutes) or distance (meters) threshold. |
required |
weight_type
|
Literal['time_min', 'length_meter']
|
Type of weight calculation: - "time_min": Time-based in minutes - "length_meter": Distance-based in meters |
required |
nx_graph
|
Graph
|
NetworkX graph representing the transportation network. |
required |
step
|
float
|
Interval between isochrone steps. Defaults to: - 100 meters for distance-based - 1 minute for time-based |
None
|
**kwargs
|
Any
|
Additional parameters: - buffer_factor: Size multiplier for buffers (default: 0.7) - road_buffer_size: Buffer size for road edges in meters (default: 5) |
{}
|
Returns:
Type | Description |
---|---|
tuple[GeoDataFrame, GeoDataFrame | None, GeoDataFrame | None]
|
Tuple containing: - stepped_isochrones: GeoDataFrame with stepped polygons and distance/time attributes - pt_stops: Public transport stops within isochrones (if available) - pt_routes: Public transport routes within isochrones (if available) |
Source code in src\objectnat\methods\isochrones\isochrones.py
22 23 24 25 26 27 28 29 30 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 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
|
get_accessibility_isochrones(isochrone_type: Literal['radius', 'ways'], points: gpd.GeoDataFrame, weight_value: float, weight_type: Literal['time_min', 'length_meter'], nx_graph: nx.Graph, **kwargs: Any) -> tuple[gpd.GeoDataFrame, gpd.GeoDataFrame | None, gpd.GeoDataFrame | None]
¶
Calculate accessibility isochrones from input points based on the provided city graph.
Supports two types of isochrones
- 'radius': Circular buffer-based isochrones
- 'ways': Road network-based isochrones
Parameters:
Name | Type | Description | Default |
---|---|---|---|
isochrone_type
|
Literal['radius', 'ways']
|
Type of isochrone to calculate: - "radius": Creates circular buffers around reachable nodes - "ways": Creates polygons based on reachable road network |
required |
points
|
GeoDataFrame
|
GeoDataFrame containing source points for isochrone calculation. |
required |
weight_value
|
float
|
Maximum travel time (minutes) or distance (meters) threshold. |
required |
weight_type
|
Literal['time_min', 'length_meter']
|
Type of weight calculation: - "time_min": Time-based accessibility in minutes - "length_meter": Distance-based accessibility in meters |
required |
nx_graph
|
Graph
|
NetworkX graph representing the transportation network. Must contain CRS and speed attributes for time calculations. |
required |
**kwargs
|
Any
|
Additional parameters: - buffer_factor: Size multiplier for buffers (default: 0.7) - road_buffer_size: Buffer size for road edges in meters (default: 5) |
{}
|
Returns:
Type | Description |
---|---|
tuple[GeoDataFrame, GeoDataFrame | None, GeoDataFrame | None]
|
Tuple containing: - isochrones: GeoDataFrame with calculated isochrone polygons - pt_stops: Public transport stops within isochrones (if available) - pt_routes: Public transport routes within isochrones (if available) |
Source code in src\objectnat\methods\isochrones\isochrones.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
|
get_clusters_polygon(points: gpd.GeoDataFrame, min_dist: float | int = 100, min_point: int = 5, method: Literal['DBSCAN', 'HDBSCAN'] = 'HDBSCAN', service_code_column: str = 'service_code') -> tuple[gpd.GeoDataFrame, gpd.GeoDataFrame]
¶
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 |
|
get_graph_coverage(gdf_to: gpd.GeoDataFrame, nx_graph: nx.Graph, weight_type: Literal['time_min', 'length_meter'], weight_value_cutoff: float = None, zone: gpd.GeoDataFrame = None)
¶
Calculate coverage zones from source points through a graph network using Dijkstra's algorithm and Voronoi diagrams.
The function works by
- Finding nearest graph nodes for each input point
- Calculating all reachable nodes within cutoff distance using Dijkstra
- Creating Voronoi polygons around graph nodes
- Combining reachability information with Voronoi cells
- Clipping results to specified zone boundary
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gdf_to
|
GeoDataFrame
|
Source points to which coverage is calculated. |
required |
nx_graph
|
Graph
|
NetworkX graph representing the transportation network. |
required |
weight_type
|
Literal['time_min', 'length_meter']
|
Edge attribute to use as weight for path calculations. |
required |
weight_value_cutoff
|
float
|
Maximum weight value for path calculations (e.g., max travel time/distance). |
None
|
zone
|
GeoDataFrame
|
Boundary polygon to clip the resulting coverage zones. If None, concave hull of reachable nodes will be used. |
None
|
Returns:
Type | Description |
---|---|
GeoDataFrame
|
GeoDataFrame with coverage zones polygons, each associated with its source point, returns in the same CRS as original gdf_from. |
Notes
- The graph must have a valid CRS attribute in its graph properties
- MultiGraph/MultiDiGraph inputs will be converted to simple Graph/DiGraph
Source code in src\objectnat\methods\coverage_zones\graph_coverage.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 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 |
|
get_radius_coverage(gdf_from: gpd.GeoDataFrame, radius: float, resolution: int = 32)
¶
Calculate radius-based coverage zones using Voronoi polygons.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gdf_from
|
GeoDataFrame
|
Source points for which coverage zones are calculated. |
required |
radius
|
float
|
Maximum coverage radius in meters. |
required |
resolution
|
int
|
Number of segments used to approximate quarter-circle in buffer (default=32). |
32
|
Returns:
Type | Description |
---|---|
GeoDataFrame
|
GeoDataFrame with smoothed coverage zone polygons in the same CRS as original gdf_from. |
Notes
- Automatically converts to local UTM CRS for accurate distance measurements
- Final zones are slightly contracted then expanded for smoothing effect
Source code in src\objectnat\methods\coverage_zones\radius_voronoi_coverage.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
|
get_service_provision(buildings: gpd.GeoDataFrame, adjacency_matrix: pd.DataFrame, services: gpd.GeoDataFrame, threshold: int, buildings_demand_column: str = 'demand', services_capacity_column: str = 'capacity') -> Tuple[gpd.GeoDataFrame, gpd.GeoDataFrame, gpd.GeoDataFrame]
¶
Calculate load from buildings with demands on the given services using the distances matrix between them.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
services
|
GeoDataFrame
|
GeoDataFrame of services |
required |
adjacency_matrix
|
DataFrame
|
DataFrame representing the adjacency matrix |
required |
buildings
|
GeoDataFrame
|
GeoDataFrame of demanded buildings |
required |
threshold
|
int
|
Threshold value |
required |
buildings_demand_column
|
str
|
column name of buildings demands |
'demand'
|
services_capacity_column
|
str
|
column name of services capacity |
'capacity'
|
Returns:
Type | Description |
---|---|
Tuple[GeoDataFrame, GeoDataFrame, GeoDataFrame]
|
Tuple of GeoDataFrames representing provision |
GeoDataFrame
|
buildings, provision services, and provision links |
Source code in src\objectnat\methods\provision\provision.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
|
get_stepped_graph_coverage(gdf_to: gpd.GeoDataFrame, nx_graph: nx.Graph, weight_type: Literal['time_min', 'length_meter'], step_type: Literal['voronoi', 'separate'], weight_value_cutoff: float = None, zone: gpd.GeoDataFrame = None, step: float = None)
¶
Calculate stepped coverage zones from source points through a graph network using Dijkstra's algorithm and Voronoi-based or buffer-based isochrone steps.
This function combines graph-based accessibility with stepped isochrone logic. It: 1. Finds nearest graph nodes for each input point 2. Computes reachability for increasing weights (e.g. time or distance) in defined steps 3. Generates Voronoi-based or separate buffer zones around network nodes 4. Aggregates zones into stepped coverage layers 5. Optionally clips results to a boundary zone
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gdf_to
|
GeoDataFrame
|
Source points from which stepped coverage is calculated. |
required |
nx_graph
|
Graph
|
NetworkX graph representing the transportation network. |
required |
weight_type
|
Literal['time_min', 'length_meter']
|
Type of edge weight to use for path calculation: - "time_min": Edge travel time in minutes - "length_meter": Edge length in meters |
required |
step_type
|
Literal['voronoi', 'separate']
|
Method for generating stepped zones: - "voronoi": Stepped zones based on Voronoi polygons around graph nodes - "separate": Independent buffer zones per step |
required |
weight_value_cutoff
|
float
|
Maximum weight value (e.g., max travel time or distance) to limit the coverage extent. |
None
|
zone
|
GeoDataFrame
|
Optional boundary polygon to clip resulting stepped zones. If None, concave hull of reachable area is used. |
None
|
step
|
float
|
Step interval for coverage zone construction. Defaults to: - 100 meters for distance-based weight - 1 minute for time-based weight |
None
|
Returns:
Type | Description |
---|---|
GeoDataFrame
|
GeoDataFrame with polygons representing stepped coverage zones for each input point, annotated by step range. |
Notes
- Input graph must have a valid CRS defined.
- MultiGraph or MultiDiGraph inputs will be simplified to Graph/DiGraph.
- Designed for accessibility and spatial equity analyses over multimodal networks.
Source code in src\objectnat\methods\coverage_zones\stepped_coverage.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 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 116 117 118 119 120 121 122 123 124 125 126 |
|
get_visibilities_from_points(points: gpd.GeoDataFrame, obstacles: gpd.GeoDataFrame, view_distance: int, sectors_n=None, max_workers: int = cpu_count()) -> list[Polygon]
¶
Calculate visibility polygons from a set of points considering obstacles within a specified view distance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
points
|
GeoDataFrame
|
GeoDataFrame containing the points from which visibility is calculated. |
required |
obstacles
|
GeoDataFrame
|
GeoDataFrame containing the obstacles that block visibility. |
required |
view_distance
|
int
|
The maximum distance from each point within which visibility is calculated. |
required |
sectors_n
|
int
|
Number of sectors to divide the view into for more detailed visibility calculations. Defaults to None. |
None
|
max_workers
|
int
|
Maximum workers in multiproccesing, multipocessing.cpu_count() by default. |
cpu_count()
|
Returns:
Type | Description |
---|---|
list[Polygon]
|
A list of visibility polygons for each input point. |
Notes
This function uses get_visibility_accurate()
in multiprocessing way.
Source code in src\objectnat\methods\visibility\visibility_analysis.py
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
|
get_visibility(point_from: Point | gpd.GeoDataFrame, obstacles: gpd.GeoDataFrame, view_distance: float, resolution: int = 32) -> Polygon | gpd.GeoDataFrame
¶
Function to get a quick estimate of visibility from a given point to buildings within a given distance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
point_from
|
Point | GeoDataFrame
|
The point or GeoDataFrame with 1 point from which the line of sight is drawn. If Point is provided it should be in the same crs as obstacles. |
required |
obstacles
|
GeoDataFrame
|
A GeoDataFrame containing the geometry of the buildings. |
required |
view_distance
|
float
|
The distance of view from the point. |
required |
resolution
|
int)
|
Buffer resolution for more accuracy (may give result slower) |
32
|
Returns:
Type | Description |
---|---|
Polygon | GeoDataFrame
|
A polygon representing the area of visibility from the given point. if point_from was a GeoDataFrame, return GeoDataFrame with one feature, else Polygon. |
Notes
This function provides a quicker but less accurate result compared to get_visibility_accurate()
.
If accuracy is important, consider using get_visibility_accurate()
instead.
Source code in src\objectnat\methods\visibility\visibility_analysis.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 |
|
get_visibility_accurate(point_from: Point | gpd.GeoDataFrame, obstacles: gpd.GeoDataFrame, view_distance, return_max_view_dist=False) -> Polygon | gpd.GeoDataFrame | tuple[Polygon | gpd.GeoDataFrame, float]
¶
Function to get accurate visibility from a given point to buildings within a given distance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
point_from
|
Point | GeoDataFrame
|
The point or GeoDataFrame with 1 point from which the line of sight is drawn. If Point is provided it should be in the same crs as obstacles. |
required |
obstacles
|
GeoDataFrame
|
A GeoDataFrame containing the geometry of the obstacles. |
required |
view_distance
|
float
|
The distance of view from the point. |
required |
return_max_view_dist
|
bool
|
If True, the max view distance is returned with view polygon in tuple. |
False
|
Returns:
Type | Description |
---|---|
Polygon | GeoDataFrame | tuple[Polygon | GeoDataFrame, float]
|
A polygon representing the area of visibility from the given point or polygon with max view distance. if point_from was a GeoDataFrame, return GeoDataFrame with one feature, else Polygon. |
Notes
If a quick result is important, consider using the get_visibility()
function instead.
However, please note that get_visibility()
may provide less accurate results.
Source code in src\objectnat\methods\visibility\visibility_analysis.py
25 26 27 28 29 30 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 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
|
graph_to_gdf(graph: nx.MultiDiGraph | nx.Graph | nx.DiGraph, edges: bool = True, nodes: bool = True, restore_edge_geom=False) -> gpd.GeoDataFrame | tuple[gpd.GeoDataFrame, gpd.GeoDataFrame]
¶
Converts nx graph to gpd.GeoDataFrame as edges.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
graph
|
MultiDiGraph
|
The graph to convert. |
required |
edges
|
bool
|
Keep edges in GoeDataFrame. |
True
|
nodes
|
bool
|
Keep nodes in GoeDataFrame. |
True
|
restore_edge_geom
|
bool
|
if True, will try to restore edge geometry from nodes. |
False
|
Returns: (gpd.GeoDataFrame | tuple[gpd.GeoDataFrame, gpd.GeoDataFrame]): Graph representation in GeoDataFrame format, either nodes or nodes,or tuple of them nodes,edges.
Source code in src\objectnat\methods\utils\graph_utils.py
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 |
|
simulate_noise(source_points: gpd.GeoDataFrame, obstacles: gpd.GeoDataFrame, source_noise_db: float = None, geometric_mean_freq_hz: float = None, **kwargs)
¶
Simulates noise propagation from a set of source points considering obstacles, trees, and environmental factors.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source_points
|
GeoDataFrame
|
A GeoDataFrame with one or more point geometries representing noise sources. Optionally, it can include 'source_noise_db' and 'geometric_mean_freq_hz' columns for per-point simulation. |
required |
obstacles
|
GeoDataFrame
|
A GeoDataFrame representing obstacles in the environment. If a column with sound absorption coefficients
is present, its name should be provided in the |
required |
source_noise_db
|
(float
|
Default noise level (dB) to use if not specified per-point. Decibels are logarithmic units used to measure sound intensity. A value of 20 dB represents a barely audible whisper, while 140 dB is comparable to the noise of jet engines. |
None
|
geometric_mean_freq_hz
|
float
|
Default frequency (Hz) to use if not specified per-point. This parameter influences the sound wave's propagation and scattering in the presence of trees. Lower frequencies travel longer distances than higher frequencies. It's recommended to use values between 63 Hz and 8000 Hz; values outside this range will be clamped to the nearest boundary for the sound absorption coefficient calculation. |
None
|
Optional kwargs
- absorb_ratio_column (str, optional): The name of the column in the
obstacles
GeoDataFrame that contains the sound absorption coefficients for each obstacle. Default is None. If not specified, all obstacles will have thestandart_absorb_ratio
. - standart_absorb_ratio (float, optional): The default sound absorption coefficient to use for obstacles without
specified values in the
absorb_ratio_column
. Default is 0.05, which is a typical value for concrete walls. - trees (gpd.GeoDataFrame, optional): A GeoDataFrame containing trees or dense vegetation along the sound wave's path. Trees will scatter and absorb sound waves.
- tree_resolution (int, optional): A resolution parameter for simulating tree interactions with sound waves. Recommended values are between 2 and 16, with higher values providing more accurate simulation results.
- air_temperature (float, optional): The air temperature in degrees Celsius. The recommended range is from 0 to 30 degrees Celsius, as temperatures outside this range will be clipped. Temperature affects the sound propagation in the air.
- target_noise_db (float, optional): The target noise level (in dB) for the simulation. Default is 40 dB. Lower values may not be relevant for further analysis, as they are near the threshold of human hearing.
- db_sim_step (float, optional): The step size in decibels for the noise simulation. Default is 1. For more
precise analysis, this can be adjusted. If the difference between
source_noise_db
andtarget_noise_db
is not divisible by the step size, the function will raise an error. - reflection_n (int, optional): The maximum number of reflections (bounces) to simulate for each sound wave. Recommended values are between 1 and 3. Larger values will result in longer simulation times.
- dead_area_r (float, optional): A debugging parameter that defines the radius of the "dead zone" for reflections. Points within this area will not generate reflections. This is useful to prevent the algorithm from getting stuck in corners or along building walls.
- use_parallel (bool, optional): Whether to use ProcessPool for task distribution or not. Default is True.
Returns: (gpd.GeoDataFrame): A GeoDataFrame containing the noise simulation results, including noise levels and geometries of the affected areas. Each point's simulation results will be merged into a single GeoDataFrame.
Source code in src\objectnat\methods\noise\noise_simulation.py
28 29 30 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 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
|