Water and 3MF parts¶
satprint.water
¶
Water map for multi-color prints: which terrain grid cells are water.
Water shapes come from the water layer of the same OpenFreeMap vector
tiles the buildings use (sea, rivers, lakes, ponds). Where the sea was
flattened to 0 m, the flattened cells count as water too, so a coast still
colors when the tiles are unavailable.
multicolor_parts(polygons, bbox, relief_mm, width_mm, depth_mm, base_mm, sea_level_flat=False, buildings=None, frame=None)
¶
The 3MF parts, land, water, buildings and border, and the water mask.
Parts without geometry are left out, so the filament numbers stay in this order: land 1, water 2, then buildings and border as present.
Returns:
| Type | Description |
|---|---|
tuple[list[tuple[str, Mesh, str]], ndarray]
|
([(name, mesh, color), ...] for :func: |
Source code in satprint/water.py
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 | |
water_from_vector_tiles(tiles)
¶
Water polygons, in lon/lat, from the tiles' water layer.
Source code in satprint/water.py
43 44 45 46 47 48 49 | |
water_mask(polygons, bbox, relief_mm, width_mm, depth_mm, sea_level_flat=False)
¶
(rows-1, cols-1) boolean grid: True where a terrain cell is water.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
polygons
|
list[Polygon]
|
water shapes in lon/lat. |
required |
bbox
|
BBox
|
area the block covers. |
required |
relief_mm
|
ndarray
|
the relief passed to :func: |
required |
width_mm
|
float
|
block width. |
required |
depth_mm
|
float
|
block depth. |
required |
sea_level_flat
|
bool
|
the sea was flattened to the lowest relief, so cells lying flat there count as water. |
False
|
Returns:
| Type | Description |
|---|---|
ndarray
|
the mask, row 0 north, as the heightmap. |
Source code in satprint/water.py
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 | |
water_zoom(bbox)
¶
Highest vector-tile zoom (8-14) covering bbox in MAX_WATER_TILES.
A city reuses the zoom-14 tiles its buildings came from.
Source code in satprint/water.py
32 33 34 35 36 37 38 39 40 | |