Skip to content

Styling data

3D

Raise polygons by a column: population towers, building heights.

Quick reference

Utility Does Example
extrude-[<expr>]
extrude-max-<metres>
3D height from data, and the height of the tallest feature extrude-[pop]
extrude-[floors*3]
extrude-max-5000

Height from data

extrude-[pop] raises each polygon by its value; the tallest feature is extrude-max metres high, or a tenth of the data's width when not set. The camera tilts to 45 degrees. The legend adds a height key saying what height shows and how tall the tallest is.

kh.map(states, "theme-midnight fill-[pop] ramp-plasma scheme-q5 extrude-[pop]",
       legend={"title": "Population", "fmt": "{:,.0f}"})

True heights

Set extrude-max to the tallest value and every feature is drawn at its real height in metres:

buildings-3d

tallest = buildings["height_m"].max()
kh.map(buildings, f"theme-midnight fill-[height_m] ramp-magma scheme-linear extrude-[height_m] extrude-max-{tallest:.0f}",
       legend={"title": "Height, m"})

Notes

  • 3D lighting darkens colours a little; extruded layers skip near-white ramp colours and draw edges a shade darker than the fill.
  • Negative and missing values are drawn flat, with a warning.
  • buildings-3d raises the basemap's own buildings; see Relief and buildings.