You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Manages building footprint data and generates 3D meshes for CFD simulations.
5
+
Manages building footprint data — query by bounding box, extract heights, compute urban morphology parameters (plan area fraction, frontal area density, average building height), generate 3D STL meshes for CFD simulations, and group buildings into convex clusters.
6
6
7
-
**Data source format:**
7
+
```python
8
+
from hera import toolkitHome
9
+
10
+
# Tip: if you created the project with `hera-project project create`, you can omit projectName
For the full API, see the [API Reference](../../developer_guide/api/measurements.md). For implementation details, see the [Developer Guide](../../developer_guide/measurements/gis.md).
27
+
28
+
---
29
+
30
+
## Data source format
8
31
9
32
| Property | Value |
10
33
|----------|-------|
@@ -13,22 +36,210 @@ Manages building footprint data and generates 3D meshes for CFD simulations.
13
36
| Required columns |`geometry`|
14
37
| Height column |`BLDG_HT` (or as specified in `desc.BuildingHeightColumn`) — building height in meters |
15
38
| Ground height |`HT_LAND` (or as specified in `desc.LandHeightColumns`) — ground elevation |
16
-
| Fallback | If no height column, uses `building:levels × 3` meters |
39
+
| Fallback | If no height column, uses `building:levels * 3` meters |
17
40
| CRS | Any (must be defined; methods handle transformation) |
windMeteorologicalDirection=270, # wind direction in degrees
121
+
resolution=250, # block size in meters
122
+
buildingsData=gdf, # GeoDataFrame with CRS set
123
+
overwrite=False, # recompute even if cached
124
+
saveCache=True, # cache results in DB
125
+
)
126
+
```
127
+
128
+
**Returns** a GeoDataFrame with one row per block:
129
+
130
+
| Column | Description |
131
+
|--------|-------------|
132
+
|`geometry`| Block polygon |
133
+
|`lambdaP`| Plan area fraction: total building footprint area / block area |
134
+
|`lambdaF`| Frontal area density: total building frontal area / block area (wind-direction dependent) |
135
+
|`hc`| Area-weighted average building height within the block |
136
+
|`i0`, `j0`| Block grid indices |
137
+
138
+
Results are cached in the project's cache collection (type `Lambda_Buildings`). Subsequent calls with the same bounds, wind direction, resolution, and CRS return the cached result. Use `overwrite=True` to force recomputation.
139
+
140
+
### How it works
141
+
142
+
1. The domain (from `buildingsData.total_bounds`) is divided into a grid of square blocks at the given resolution
143
+
2. For each block:
144
+
-**lambda_P** = sum of building plan areas / block area (excludes buildings with `FTYPE` 14 or 16, and buildings with zero height)
145
+
-**lambda_F** = sum of building frontal areas / block area (frontal area is computed by rotating each building footprint to the wind direction and measuring the projected width * height)
146
+
-**hc** = sum(area * height) / sum(area) — area-weighted mean building height
147
+
3. Buildings with no land height (`HT_LAND=0`) use the nearest building's land height as a fallback
148
+
149
+
### Convex building clusters
150
+
151
+
Group nearby buildings into convex hulls (useful for identifying urban blocks):
152
+
153
+
```python
154
+
clusters = buildings.analysis.ConvexPolygons(
155
+
regionNameOrData=gdf, # GeoDataFrame or region name
156
+
buffer=100, # buffer distance for grouping (meters)
157
+
)
158
+
# Returns GeoDataFrame of convex hull polygons, sorted by area
159
+
```
160
+
161
+
The algorithm:
162
+
1. Buffers each building footprint by `buffer` meters
163
+
2. Groups intersecting buffered footprints
164
+
3. Computes the convex hull of each group
165
+
4. Recursively merges overlapping hulls
166
+
167
+
---
168
+
169
+
## 3D STL generation
170
+
171
+
Generate 3D building meshes for CFD simulations using the FreeCAD module.
172
+
173
+
### From a bounding box (recommended)
174
+
175
+
```python
27
176
buildings.regionToSTL(
28
177
minx=35.0, miny=32.0, maxx=35.1, maxy=32.1,
29
-
dxdy=30, inputCRS=4326, outputCRS=2039,
30
-
solidName="Buildings", fileName="buildings.stl"
178
+
dxdy=30, # grid resolution
179
+
inputCRS=4326, # input coordinate system
180
+
outputCRS=2039, # output coordinate system (ITM)
181
+
solidName="Buildings",
182
+
fileName="buildings.stl",
31
183
)
32
184
```
33
185
34
-
For the full API, see the [API Reference](../../developer_guide/api/measurements.md).
0 commit comments