Roads¶
satprint.roads
¶
OpenStreetMap roads -> one thin solid draped over the terrain.
Roads come from the transportation layer of the OpenFreeMap vector tiles
the buildings and bridges use. Each line is drawn as a strip of a width per
class (:data:satprint.bridges.BRIDGE_WIDTH_M), never narrower than a
printable min_width_mm. At print scale a street is a fraction of a nozzle
wide, so most roads are drawn wider than they are, and minor classes are left
out of large areas, where they would cover the land (:data:ROAD_MIN_SCALE).
The strips are joined into one footprint, with water, building footprints
and bridges cut out, and the footprint is cut along the triangles of a lattice of the
terrain grid's nodes (:func:_lattice), every node on a coarse grid. Each
piece lies on one flat lattice triangle, so its top sits a fixed height above
the lattice surface; that height is height_mm plus however far the terrain
rises above the lattice under the roads, so the top clears the terrain by at
least height_mm and the floor sinks at least sink_mm into it. Pieces
share their vertices, and walls stand only on the footprint's outer
edges, as in :func:satprint.mesh.heightmap_split_solids, so each connected
road network is a single closed solid. Tunnels are left out; bridges over
water are :mod:satprint.bridges' job.
road_classes(detail, mm_per_m)
¶
The classes drawn at detail for a model at mm_per_m.
Source code in satprint/roads.py
75 76 77 78 79 80 81 | |
road_mesh(lines, water, footprints, bbox, relief_mm, width_mm, depth_mm, base_mm, mm_per_m, detail='auto', height_mm=0.4, sink_mm=0.3, min_width_mm=0.8, simplify_mm=0.05, min_area_mm2=0.2, lattice_mm=0.6, lattice_tol_mm=0.3, bridges=None)
¶
Roads as a thin solid on the terrain block built from relief_mm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lines
|
list[tuple[LineString, str]]
|
(road line in lon/lat, OpenMapTiles class) pairs. |
required |
water
|
list[Polygon]
|
water polygons in lon/lat; roads stop at the water. |
required |
footprints
|
list[Polygon]
|
building footprints in lon/lat; roads stop at them. |
required |
bbox
|
BBox
|
area the terrain block covers. |
required |
relief_mm
|
ndarray
|
the relief passed to :func: |
required |
width_mm
|
float
|
block width. |
required |
depth_mm
|
float
|
block depth. |
required |
base_mm
|
float
|
base thickness under the lowest terrain. |
required |
mm_per_m
|
float
|
horizontal model scale. |
required |
detail
|
Detail
|
which classes to draw (:func: |
'auto'
|
height_mm
|
float
|
height of the road top above the terrain. |
0.4
|
sink_mm
|
float
|
depth of the road floor below the terrain. |
0.3
|
min_width_mm
|
float
|
narrowest a road is drawn. |
0.8
|
simplify_mm
|
float
|
footprint simplification tolerance. |
0.05
|
min_area_mm2
|
float
|
connected pieces smaller than this are dropped. |
0.2
|
lattice_mm
|
float
|
roads are cut on a lattice of terrain grid nodes about
this far apart, not on every terrain cell (:func: |
0.6
|
lattice_tol_mm
|
float
|
the lattice is made finer until the terrain under the roads strays no more than this from it. Roads are raised and sunk by what strays, so they never sink into the terrain or float. |
0.3
|
bridges
|
BuildingMesh | None
|
bridge solids from :func: |
None
|
Returns:
| Type | Description |
|---|---|
BuildingMesh
|
the roads as one :class: |
Source code in satprint/roads.py
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 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | |
roads_from_vector_tiles(tiles)
¶
Road lines, in lon/lat, from the tiles' transportation layer.
Tunnels are left out, and so are classes not in :data:ROAD_MIN_SCALE,
such as rail, ferries and roads under construction.
Returns:
| Type | Description |
|---|---|
list[tuple[LineString, str]]
|
(line, OpenMapTiles class) pairs. |
Source code in satprint/roads.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |