Turning free map data into a 3D city block
opencity-forge turns free, public map data into a photo-textured 3D model of a real city block. The code is open source: github.com/vertoforce/opencity-forge.
Boston Public Garden. Street imagery © Mapillary contributors (CC BY-SA), map data © OpenStreetMap contributors (ODbL), aerial imagery USDA NAIP, elevation USGS 3DEP.
What goes in
Four free sources, all available for most of the US:
- Street photos from Mapillary: 360° panoramas people upload. These give each building its real walls.
- Lidar from USGS: laser height scans flown from planes. These give real building and tree heights.
- Aerial photos from USDA NAIP. These give the ground its real colour.
- OpenStreetMap: building outlines, paths and street furniture.
You draw a box on the map. Out comes a 3D model you can walk through in a browser.
How it works
- Raise each building outline to its lidar height.
- Colour the ground from the aerial photo, sorted by surface type such as lawn or paving.
- Place each street panorama where it was taken, then paint the walls it can see.
- Add trees and street furniture where the map and lidar say they are.
What makes the wall photos hard
A wall is only painted from a panorama that sees it clearly. A photo is skipped if the camera sees the wall edge-on, if it is too far away, or if a tree, car or sky covers that part of the photo. Mapillary already labels those things in each photo, so no extra model is needed.
A wall with no good photo gets the colour of the nearest photographed buildings. That beats a stock grey, but it is still a flat colour.
How it differs from other tools
Tools like OSM2World already turn OpenStreetMap into 3D. They build from the map alone, so every building gets the same stock window texture and a guessed height. opencity-forge uses the real photos and the real heights, so the model looks like the actual place.
What it doesn’t do well yet
- Trees are simple cylinders.
- Some walls are a flat colour. Street photos miss them, or see them edge-on in narrow downtown streets.
Try it
You need a free Mapillary token. Then:
python3.11 -m venv .venv && .venv/bin/pip install -r requirements.txt
./opencity new-area my_block --bbox=W,S,E,N
./opencity fetch my_block && ./opencity build my_block
./opencity check my_block
A small block takes about 20 minutes on one machine with a GPU. The repo README has the details.
The code is MIT licensed. The models it makes carry the licenses of the data that went in, so keep the credits above when you share one.