How we built Hyderabad in 3D from OpenStreetMap
How Sawari builds 3D Hyderabad: OpenStreetMap data via Overpass, flyovers, terrain from open elevation tiles, low-poly Three.js rendering and traffic AI.

Sawari's 3D Hyderabad is built from open data: the streets, flyovers and buildings come from OpenStreetMap, the hills from open elevation tiles, and everything is drawn in the browser with Three.js. This is how the pieces fit together, and where the map ends and our estimates begin.
Starting from the map
Each of the five routes is defined by a short list of waypoints: a latitude, a longitude, the name of the road and, where it matters, the direction of travel. That last part picks the correct side of a divided road. Everything else is worked out from the map.
The script tools/fetch-osm.mjs takes those waypoints, draws a box round them with a margin of 450 metres, and asks the Overpass API for the OpenStreetMap data inside. There are several queries:
- The main one: every road from residential lanes up to motorways and their slip roads, buildings, lakes, parks, mapped trees and traffic signals.
- Context: walls and fences, metro and railway lines, stations, bus stops, petrol pumps, land use, rocks and any mapped traffic calming.
- Names: shops, restaurants, banks, hospitals, schools and offices that have a name, so real signboards can go on the right buildings.
The results are cached locally, so the data is only downloaded once per area. The same script fetches the elevation tiles that cover each route.
Turning map data into a world
The heavy lifting happens in tools/build-data.mjs. It turns the raw downloads into one compact file per route, in local metres from the route's start.
Roads and lanes
Each road is classified by its OpenStreetMap highway type. Where the map gives the number of lanes, the width or the speed limit, those are used. Where it does not, sensible defaults fill in by road class: a lane width of about 3.4 metres on main roads, narrower on colony streets, and fewer lanes on one-way roads. A check stops the traffic from trying to fit two lanes onto a road too narrow for them.
The script then builds a routing graph, finds the cheapest path through the waypoints and works out a "keep left" driving line, since India drives on the left. Turn-by-turn instructions come from the same path.
Flyovers and bridges
OpenStreetMap marks bridges but does not usually say how high they are. So connected bridge sections are grouped, and each group is lifted 6.5 metres for each level it sits on. Very short bridges (under 80 metres in total) are treated as culverts and kept low. The ramps are then sloped smoothly from the deck down to the nearest junction. Decks span straight between their ends instead of dipping into the valley or lake below. Our flyover driving guide covers what that looks like from the driver's seat.
Buildings
Building outlines come straight from the map. If a building has a mapped height or number of floors, that is used; if not, the height is estimated from the type of building, its size and the area of the city. Old City buildings are given a different character from HITEC City offices or Banjara Hills villas.
Outlines from the map and our estimated road widths do not always agree, so any building corner that pokes into a road or footpath is pushed back to the edge, and overlapping buildings are removed. Where the map has no buildings at all along a street, narrow plots are filled in on both sides, set back to the footpath and kept clear of junctions, water and parks. These filler buildings are marked as estimated.
Places of worship from the map get their own architecture, and named shops, restaurants and banks put their real names on the nearest building.
Trees, lamps and signals
Mapped trees are kept, and parks are filled in. OpenStreetMap has very few street lamps or roadside trees mapped here, so these are laid out the way Hyderabad roads usually look: double-arm lamps on the median of divided roads about every 32 metres, single-arm lamps along the footpath on other main roads, and trees behind the footpath, never on the carriageway.
Traffic signals come from the map, but the map does not have them all. Where main roads cross near the route and nothing is mapped, the builder adds signals, starting with the biggest junctions and never within 150 metres of another signalled junction. All the signals at one junction share a cycle so they agree with each other.
Terrain from open elevation tiles
Hyderabad is not flat. The Deccan plateau rolls, and some roads climb noticeably: Banjara Hills Road No. 1 rises about 37 metres along its route. To get this right, tools/terrain.mjs reads the Terrain Tiles open dataset, hosted on AWS and derived from SRTM and other public sources.
The tiles store height as colour in "Terrarium" PNG images: the red, green and blue values of each pixel combine into a height in metres. The script decodes them, samples a regular grid over the area and smooths it. The source data has spikes and noise from dense buildings, so the smoothing removes those while keeping the real hills.
Then the roads are graded. Sampled on its own, each carriageway of a divided road on a hillside would come out at a different height, and side roads would drop straight off the main road. So the two halves are brought to a common height, and side roads ease out of junctions at no more than about 6 per cent.
Rendering a low-poly city with Three.js
The game is a Three.js driving game that runs in the browser, built with Vite. The look is deliberately simple and low-poly: flat-shaded, vertex-coloured shapes, with textures only where they help, such as the asphalt and the tiled footpaths.
Performance comes from a few habits:
- Merged geometry. Roads, buildings and props are merged into large meshes by material, so the graphics card draws thousands of objects in a few calls.
- Tiles. The merged meshes are split into ground tiles a couple of hundred metres across, so only what is in view is drawn.
- Instancing. Repeated objects like trees, lamps and pedestrians are drawn as instances of one model.
- Dynamic resolution. If frames run slower than about 42 a second for a couple of seconds, the game lowers its resolution a little. The Fast graphics setting turns off sun shadows for older machines.
Time of day is a set of lighting presets for the sun, sky, fog and exposure. At night, street lamps glow and light the road beneath them, windows light up, and each vehicle gets lamps front and back.
Traffic and people
The traffic is made of low-poly versions of the vehicle types you see on Hyderabad roads, with generic shapes and no brand styling: hatchbacks, sedans, SUVs, autos, mini trucks, buses and many scooters and motorbikes. Each AI driver plans a short path ahead, keeps a following gap, brakes comfortably to stop at red lights, slows for speed breakers and stops for people in the way. Where two paths cross, both drivers read the same decision about who goes first, so they never both go or both wait. Two-wheelers filter past slower vehicles on their right.
Real crashes come from inattention, so the AI has a small chance of a moment's distraction, which is the only way two AI drivers collide. Pedestrians walk the footpaths in outfits that shift with the area. You can read more about how this feels to drive in our post on sharing the road.
What is mapped and what is estimated
We try to be honest about the difference. As the about page sets out:
| From the map or elevation data | Estimated by rule |
|---|---|
| Roads, lanes, one-way streets, flyovers | Speed breakers and U-turn openings |
| Building outlines, heights where mapped | Facades and filler buildings |
| Lakes, parks, signals, bus stops, metro lines | Stalls, parked vehicles, hoardings |
| Places of worship, shop names, ground height | Most street lamps and roadside trees |
So the layout of a junction is real, but the stall on its corner is not. Treat the city as realistic rather than exact.
Credit and licence
Map data is © OpenStreetMap contributors, available under the Open Database Licence (ODbL). The route files the game loads are a derivative database under that licence: anyone redistributing them must keep the attribution and share them under the ODbL. If a street looks wrong in the game, the best fix is often to improve OpenStreetMap itself, which helps everyone who uses it.
To see the result, drive one of the routes, or look at the route list and the features page first. Our free online driving simulator post explains what you can practise.
Frequently asked questions
Is Sawari's 3D Hyderabad an exact copy of the city?
No. Roads, lanes, flyovers, building outlines, signals and places of worship come from OpenStreetMap, and ground height from open elevation data. Facades, stalls, hoardings, most street lamps, speed breakers and some filler buildings are generated by rule, so they are realistic rather than exact.
What is the game built with?
The game uses Three.js for 3D rendering in the browser and Vite to build the site. The city data is prepared ahead of time by Node.js scripts that read OpenStreetMap data and open terrain tiles.
Can I use OpenStreetMap data to build my own 3D city?
Yes. OpenStreetMap data is available under the Open Database Licence, which lets you use it, including in derived data, as long as you credit OpenStreetMap contributors and share derived databases under the same licence.
Why does the map have gaps in some areas?
OpenStreetMap is mapped by volunteers, and coverage varies from street to street. Where buildings or other details are missing, Sawari fills in plausible ones, and the about page lists what is estimated.
Sawari is a practice simulator. It does not replace lessons with a licensed instructor or the official RTA test. Always follow the signs, signals and traffic police on the real road.