Zero Labs
Industry News / AI

I Drew Bangkok in Pixels, and My Laptop Painted It Overnight

Source · Towards AI By Rizwanul Islam Rudra

From the publisher’s feed, collected in the ZeroLabs newsroom.

How I built Pixel Bangkok, a 20 km isometric pixel-art map of the city, from open data, a Mac GPU and a lot of checking.Graphics: pixelbangkok.comLate at night, I fell into isometriccities.com and lost an evening. New York, Tokyo, Singapore: whole cities drawn as tiny isometric worlds, the kind of view you remember from SimCity. Andy Coenen’s Isometric NYC was the one that hooked me. I kept zooming in, finding streets I knew.Image: captured from isometriccities.comThere was no Bangkok. So I decided to make one.Ten days later, Pixel Bangkok is live at pixelbangkok.com: 20 × 20 km of central Bangkok, more than 700,000 buildings, 521 places in Thai and English, 88 rail stations, and cars, tuk-tuks and boats moving through it.This is how I built it, what went wrong, and what I learned working with AI coding agents.One rule before any codeIt looks great, and it fills every street automatically. But when I read Google’s Map Tiles API policies, they ask you not to create content based on Google Maps content, or to store and redistribute tiles outside Google’s own services. Downloading tiles, repainting them and publishing the result as my own map would go against both, so it was off the table for me.That forced a different approach, and a rule I kept coming back to: the map has to be true. Every building, canal and road sits where it really is, and nothing is invented to make a picture look fuller. If a building’s height isn’t known, the map says so (internally, at least) instead of guessing.So instead of painting a photo, I draw the city from data:OpenStreetMap for roads, canals, railways, landmarks and buildingsGoogle Open Buildings 2.5D for building heights (a satellite-derived height raster)Wikidata and published figures for the tallest towers, because the satellite heights stop near 100 mMeta and WRI canopy maps for every treeOverture Maps for the buildings OpenStreetMap hasn’t mapped yet (more on that below)Every building keeps a record of where its height came from: sourced, estimated from the raster, set by hand, or unknown. That sounds like bookkeeping, but it saved me more than once when something looked wrong.Every building keeps a record of where its height came from: sourced, estimated from the raster, set by hand, or unknown. That sounds like bookkeeping, but it saved me more than once when something looked wrong.The architecture: three parts that never mixI split the project into three pieces that only talk through files:Figure: Pixel Bangkok architecture flow1. The pipeline (Python). It runs in stages: extract, normalise, enrich, render, style, tile, publish. Everything is projected into one coordinate system (UTM zone 47N, the local metric grid for Bangkok) at 3 pixels per metre, so distances are real. The renderer draws every building as an isometric prism with walls, roofs, windows and a shadow, then a style pass gives it the pixel-art look. It’s deterministic: same data, same camera, same seed, same pixels.The full Bangkok map comes out at 84,854 × 42,689 pixels, about 3.6 gigapixels. No browser should ever load that.2. The tile pyramid. So the pipeline cuts the image into a Deep Zoom pyramid: 512 px WebP tiles at 18 zoom levels, from one tiny overview tile down to full detail. For the whole of Bangkok that is about 23,500 files. A visitor only ever downloads the tiles on their screen.3. The viewer (Next.js). A full-screen map built on OpenSeadragon, with search, numbered places in walking order, Thai and English, and a traffic layer animated on a canvas above the tiles. The viewer knows nothing about how the map was made. It reads a small manifest file and asks for tiles.Keeping these apart meant I could redraw the whole city without touching the website, and redesign the website without re-rendering anything.The surprise: half of Bangkok was missingMy first full render looked oddly empty. Big beige blocks with roads running through them, where I knew there were dense neighbourhoods.My first instinct was to fill them with trees. Then I actually measured it. I compared the map with Google’s building-presence data and found that OpenStreetMap had outlines for only about a sixth of Bangkok’s buildings. The empty blocks weren’t empty. They were unmapped.Planting trees there would have drawn parks over people’s homes. Instead I pulled building outlines from Overture Maps, which combines OpenStreetMap with outlines traced from imagery by Google and Microsoft, and added only the ones that:don’t overlap a building OpenStreetMap already hasdon’t sit across a road or on the riveraren’t inside temple, palace or military groundsThat last rule matters. A machine-traced box inside Wat Pho would draw an ancient hall as a plain modern block, so sacred grounds keep only their hand-mapped buildings. The fill added about 507,000 buildings, and the map finally looked like the city I live in.Image: before and after, the same blocks empty and then filledThe AI paint, on a laptop GPUThe procedural drawing is clean but a bit flat. I wanted an optional, more painterly layer, like the AI-painted maps on Isometric Cities, without sending my map to a paid cloud API.First attempt: Qwen. I started with Qwen-Image running locally through mflux, Apple Silicon’s MLX port of image models. It worked, but its licence is research-only and non-commercial, and I wanted the project to be clean, so I dropped it.What I use now: FLUX.2 [klein] 4B with an isometric LoRA. It’s a small open model (Apache 2.0) with an “Isometric Mumbai” style LoRA, also Apache 2.0, that suited Asian streets far better than the European styles I tried. It runs 8-bit on my MacBook’s GPU in about 12 GB of memory. No tokens, no API bill, just electricity.The map is painted in overlapping 1024 px windows, about 40 seconds each, and blended at the edges. Inner Bangkok is 622 windows, so I’d start it before bed and wake up to a painted city.The part I’m proudest of is the judge. Image models love to “improve” things: move a road, invent a building, straighten a canal. So every painted window is compared with the original drawing, outline by outline. At least 90% of the drawing’s outlines must survive within 2 pixels (about 70 cm on the ground), no part of the window may slide more than 2 pixels, and at least 80% of what the AI draws must sit on real outlines. Fail any of those and the window is rejected, so that area keeps the plain drawing. In Inner Bangkok that rejected about a third of the windows, and I’m fine with that. Accuracy wins over coverage.It isn’t perfect. Small inventions, like an extra tree or some texture on open water, can still slip through, because a few new lines are allowed and featureless areas have nothing to measure against. That’s one reason the AI art is labelled beta and the plain drawing stays the default.Temples were the hard part. The style comes from a Mumbai-style LoRA, and my first worry was that it would make a Thai temple look like somewhere else. For Bangkok, that’s not a small detail. Temples, palaces, mosques, shrines and monuments like the Democracy Monument deserve to look like themselves.So the pipeline checks every one of those places after painting. Did it keep its gold? Its orange tiled roofs? Its outline? When I ran it, the most common failure wasn’t a temple turning into a different building. It was the AI quietly washing out the gilding. Any place that fails keeps the original drawing, while the streets around it stay painted. In Inner Bangkok, 91 sensitive places keep the plain drawing and 204 are painted.Making it fastImage: Lighthouse report, Performance 99, Accessibility 95, Best Practices 100, SEO 100This was the most satisfying part. A gigapixel map that scores 99 for performance on Lighthouse comes down to a few decisions:Only load what’s on screen. The viewer requests tiles for the current zoom level and viewport, and nothing else. Zoomed out, you’re looking at a few dozen small WebP files.Tiles live on a CDN, not the web server. The site itself is on Vercel, and the tiles are on Cloudflare R2 behind my own domain. R2 has no egress fees, which matters when thousands of image tiles are the whole product.Cache forever, and never get stale. Every tile is served with a one-year, `immutable` cache header, so a returning visitor’s browser doesn’t even ask for it again. The trick is in the URL: each tile request carries a short version string taken from a hash of the rendered map. When I redraw the city, the hash changes, the URLs change, and everyone gets fresh tiles with no cache purge. The only files with a short cache are the small manifest and the places list, at five minutes, so updates show up quickly.Don’t make the first screen wait for the map. The interface loads first, the tiles stream in behind it, and the traffic animation pauses when you’re zoomed out (and for anyone who prefers reduced motion).Scale the AI art differently. The pixel drawing stays crisp when magnified, but the AI art is painterly, and nearest-neighbour scaling made it shimmer and hurt to look at when zoomed in. So AI tiles are smoothed and capped at 3× zoom. A small change, but it was the most common complaint.Working with AI coding agentsI want to be honest about this part, because it’s the reason one person could build this in ten days.I worked with agentic coding tools that read the code, run commands, render the map and test the result. They wrote most of the code. My job was closer to an architect, code reviewer and an editor:I set the rules: accuracy first, no invented data, no paid services without a reason, sacred places treated with care.I chose the data and checked it against reality. The agents can’t tell that a building looks wrong. I can, because I know these streets.I made the judgement calls. Which AI style, what to do with temples, whether to ship a feature or cut it.I reviewed everything before it went live. Nothing was uploaded without my yes.The agents were fast, but they were not always right. Some things I had to catch:The Democracy Monument came out as a flat block. The fix was to draw it from OpenStreetMap’s detailed “building parts”, wings and turret at their real heights. It’s still not very perfect but we’ll keep improving.An early guard against AI changes made the map worse, painting halos around buildings. We deleted it.The “empty land, add trees” idea above. It would have been a confident, plausible, wrong answer.What made it work was testing. The pipeline has 162 automated tests and the website has 50 browser tests on desktop and mobile. When an agent changed something, the tests said whether it broke. That turned “trust the AI” into “check the AI”.What I’d tell someone starting their own city1. Start small. I proved the whole pipeline on a 3 km Old Town before attempting all of Bangkok.2. Keep the procedural render as the truth. AI paint is a layer on top, never the source.3. Check the licences early. Two of my best-looking options were off-limits once I read the terms.4. Measure before you fix. The missing-buildings problem looked like an art problem and turned out to be a data problem.5. Let agents do the typing, not the deciding.What’s nextMore of the city, a better AI-painted version, and Wat Arun and the Chao Phraya need some love. It’s a side project, so it’ll grow in my free time.You can explore it at pixelbangkok.com, on your phone or desktop. Try searching for a BTS station by its code, like E4. If you know Bangkok, I’d love to hear which neighbourhood I should draw next.Pixel Bangkok is the first Thailand entry on Isometric Cities. Map data © OpenStreetMap contributors (ODbL); extra buildings from Overture Maps (Google Open Buildings, Microsoft); building heights from Google Open Buildings 2.5D Temporal; tree canopy from Meta and WRI; AI art made with FLUX.2 [klein] and the Isometric Mumbai LoRA.I Drew Bangkok in Pixels, and My Laptop Painted It Overnight was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.