indiaciv, part 5: Climate, resources and roads
The map has terrain (part 2), people (part 3) and an economy (part 4). This part fills in the rest of what you see and hover over: rainfall, the monsoon and temperature; the tea, spice and mineral icons; and the railways and highways that appear as you zoom in. It also has my favourite bug of the project, in which the Himalaya came out warmer than Shimla.
Thirty years of weather
The India Meteorological Department publishes daily gridded climate data built from its station network: rainfall on a 0.25° grid (Pai et al., 2014) and maximum and minimum temperature on a 1° grid (Srivastava et al., 2009). The imdlib package downloads it a year at a time. I take the 30 years 1995–2024 and compute normals, long-run averages:
- Rainfall: each year’s total per cell, averaged over the 30 years.
- Monsoon share: the June–September total divided by the annual total. That’s the fraction of the year’s rain the south-west monsoon brings.
- Temperature: the daily mean , averaged over every day of every year.
Rainfall and monsoon share go onto hexes with the same exact-coverage mean as everything else. IMD’s grid only covers the mainland, so the Andaman and Nicobar Islands and Lakshadweep show “no data”.

The rainfall map is the one every Indian schoolchild draws: the Western Ghats and the north-east soaked, the Thar and Ladakh dry. The monsoon map is less familiar and more interesting. Over most of India 80–90% of the year’s rain falls in four months, but Tamil Nadu, south-east Andhra and Kerala’s south get much of theirs from the north-east monsoon in October–December. Kashmir and Ladakh get theirs from winter western disturbances.
These layers aren’t just lenses. The terrain rules in part 2 use them: jungle needs ≥ 1,800 mm of rain and ≥ 18 °C, grassland needs ≥ 1,000 mm, and under 350 mm with few trees is desert.
See rainfall around Cherrapunji on the live map →
The bug: a warm Himalaya
Temperature was the hard one. IMD’s temperature grid is coarse (1° is about 110 km), and each cell’s value is interpolated from weather stations. Weather stations are in towns, and towns are in valleys. In the mountains, a cell’s value is effectively the valley-town temperature smeared over glaciers 3 km higher.
My first version interpolated IMD’s grid to each hex centre directly. Along 78.6°E, from Agra into the Himalaya, that’s the red line:
The red line barely notices the mountains. On this transect, hexes averaging over 4,500 m came out at a mean of 16.1 °C. That’s warmer than Shimla, which sits at 2,200 m, and it fed nonsense into everything downstream: the temperature lens, the terrain rules, the hover panel. The blue line is the fix, and it’s a standard trick from climatology.
The lapse-rate method
Air cools with height, about 6.5 °C per kilometre in the standard atmosphere. So instead of interpolating temperature, interpolate sea-level temperature, which varies smoothly, and put the elevation back afterwards:
- Reduce each IMD cell to sea level using the mean elevation of the land in that cell (from the hex elevations inside it):
- Distrust high cells. Cells whose land averages above 1,500 m are interpolated from stations far below them, so even their sea-level value is wrong. They are thrown away and filled from the nearest trusted cell (a Euclidean distance transform).
- Interpolate the sea-level field bilinearly to every hex centre.
- Lift to the hex’s own elevation:
On the plains this changes almost nothing: hexes below 300 m on the transect average 25.0 °C before and 25.3 °C after. Above 4,500 m they go from 16.1 °C to −8.0 °C, which is about what you’d expect: Leh, at 3,500 m, averages around 5–6 °C, and these hexes are another kilometre or two higher. Step 4 also adds detail the coarse grid never had: a deep valley and the ridge next to it now differ by their real height difference.
It’s still a model. A single lapse rate ignores inversions, aspect and the rain shadow, and the refilled cells borrow their sea-level temperature from the foothills. But it’s physically grounded, and it turns a number that was plainly wrong into one that’s roughly right.
See the temperature lens over Ladakh →
Resources: who grows the tea
Strategy maps scatter special resources (spices, tea, iron) as icons, and their placement has to come from somewhere. The rule I settled on: an icon marks a district that is one of the main producers nationally.
For crops, from the DES district statistics, sort districts by production and take the smallest set that together make 60% of national output, with at least 3 and at most 12 districts per crop. Each gets an icon on its best hex: the hex with the most cropland, or the most tree cover for tree crops like pepper, cardamom and cashew. Spice icons also carry the Spices Board’s state figure.
- Tea and coffee aren’t in the crop tables, so they come from the Tea Board (2024) and Coffee Board
(2025-26) regional figures: Assam Valley, Darjeeling, the Nilgiris, Chikmagalur and so on. These are
mapped to districts by hand in
data/resource_regions.csv. - Minerals come from OpenStreetMap mines tagged with a
resource(coal, iron ore, bauxite, limestone…). OSM coverage is uneven: Meghalaya’s small coal pits are mapped in great detail, and some large open-cast mines barely at all. So each state is capped at two mineral districts. The proper source is the Indian Bureau of Mines’ district production, which needs a manual download (it’s indata/MANUAL.md).

130 icons: the spices and plantations cluster in the south-west and the north-east, the minerals on the Chota Nagpur plateau and in the Deccan, sugarcane and cotton in Maharashtra and Gujarat. Each icon’s tooltip names its district, region and the production figure behind it.
On top of that are map sites: power plants of 500 MW or more from the WRI Global Power Plant Database (hydro of 100 MW or more shown as dams), airports with IATA codes, and ports from OSM. WRI’s data runs to about 2021, so the newest solar parks are missing. Another known gap, documented in the README.
See the spice coast around Munnar →
Railways and highways
The last layer is infrastructure: railways, and national highways (OSM motorway and trunk). One
pass with pyosmium over the OSM India extract (1.9 GB) pulls every way with those tags.
Unlike rivers, which run along hex edges, roads and railways run centre to centre: a line joins two
hexes if it passes from one to the other. Each line is sampled every , about 3.8 km. Whenever
two consecutive samples fall in neighbouring hexes, that link gets a vote. The result is stored like the
river mask, as 6 bits per hex, bit set if there is a link to the neighbour across edge :
rail.u8 and road.u8.

At 20 km that’s a strategy-game road network: the main trunk routes are recognisable, so are the railway along the Konkan coast and the dense mesh over the Gangetic plain. In the browser these fade in at mid zoom, roads as a pale track with a dark edge and railways as a dark line with a light centre, under the city banners.
Next: the browser
That’s the whole pipeline: about twenty sources, five stages, 61 checks, and a 325 KB bundle. The last part is about drawing it: painting every texture in code at page load, keeping 50,000 sprites at 60 fps, what made my first version slower than usaciv and how I found out, and the four visual themes.