library(gePoints)
library(readr)
library(dplyr)
library(gt)
kauai <- read_csv(
"text, lat, lon, elev_m, rain_mm
Waimea, 21.9563, -159.6722, 6, 531
Eleele, 21.9035, -159.5772, 50, 762
Wahiawa, 21.8963, -159.5572, 66, 918
Lihue Airport, 21.9816, -159.3422, 31, 1015
West Lawai, 21.8902, -159.5172, 64, 1165
Puu Auau, 22.1828, -159.3322, 101, 1193
Kanalohuluhulu, 22.1302, -159.6589, 1098, 1568
Halenanaho, 21.9649, -159.4305, 149, 1905
Koloko Res, 22.1814, -159.3778, 224, 1993
Kapahi, 22.1000, -159.3800, 159, 2140
Pow Hse Wainiha, 22.1918, -159.5555, 30, 2746
Waialeale Trail, 22.0761, -159.5361, 1390, 4068
Wailua Ditch, 22.0625, -159.4677, 338, 4092
Kilohana Alakai, 22.1541, -159.5946, 1220, 4373
Mt. Waialeale, 22.0709, -159.4980, 1570, 10004"
)
gt(kauai) |>
tab_caption(caption = "Kauai Rainfall Stations") |>
tab_source_note(source_note = "Source: NOAA / Hawaii State Climate Office") |>
fmt_number(columns = rain_mm, use_seps = TRUE, decimals = 0)7 Example: Kauai Rainfall Gradient
Kauai has one of the steepest rainfall gradients on Earth. The town of Waimea, on the dry leeward coast, receives about 530 mm of rain per year. Thirty kilometers away and 1,570 meters up, the summit of Mt. Waialeale receives over 10,000 mm — among the highest recorded anywhere on the planet. The factor-of-twenty difference across such a short distance is driven by orographic lifting: moisture-laden trade winds hit the mountain, rise, cool, and release their water on the windward slopes.
This example maps 15 rainfall stations along the gradient, using marker scaling to encode rainfall amount and color to distinguish low, moderate, and extreme precipitation zones.
7.1 The data
The rainfall column spans from 531 mm (Waimea) to 10,004 mm (Mt. Waialeale). The elevation ranges from 6 m at the coast to 1,570 m at the summit. With the data in a gt table, the gradient is already visible — the numbers climb as you read down the rows.
7.2 Basic KML
create_kml(kauai, "kauai_basic.kml")In Google Earth, 15 red pushpins appear scattered across Kauai. The spatial pattern is already informative — stations cluster along the coast and thin out toward the interior — but the rainfall values are invisible.
7.3 Styled version: color and scale by rainfall
Encode rainfall in both color and marker size:
kauai_styled <- kauai |>
mutate(
comment = paste0(
"Elevation: ", elev_m, " m\n",
"Rainfall: ", format(rain_mm, big.mark = ","), " mm/yr"
),
color = case_when(
rain_mm < 1000 ~ "yellow",
rain_mm < 2000 ~ "green",
rain_mm < 4000 ~ "blue",
TRUE ~ "purple"
),
symbol = "paddle",
symbol_scale = 0.6 + (log10(rain_mm) / 2.5),
text_color = "white",
text_scale = 0.8
)
create_kml(kauai_styled, "kauai_rainfall.kml")
preview_map(kauai_styled)The log scaling is important. A linear scale from 531 to 10,004 would make the dry-coast markers nearly invisible. The logarithmic transform compresses the range so that all stations are legible while still showing clear size differences between the dry coast and the wet summit.
7.4 What the map reveals
Open kauai_rainfall.kml in Google Earth and the orographic pattern jumps out. The yellow markers line the southwest coast. Green markers appear at moderate elevations. Blue markers cluster on the windward slopes. The purple markers — Mt. Waialeale and its neighbors — sit in the interior highlands.
The 3D terrain in Google Earth makes the causal mechanism visible in a way no flat map can. Toggle on terrain view and the relationship between elevation, aspect, and rainfall is unmistakable. The windward slopes are green and deeply eroded; the leeward coast is brown and dry. The markers sit in their landscape context.
Click any marker to see the popup: elevation and rainfall for that station. The transition from 531 mm at Waimea to 10,004 mm at Waialeale — a factor of nearly 20 — happens over a horizontal distance shorter than a half-marathon.
This is a 15-point dataset, but it tells a complete geophysical story.