Construction Twin is a Rails-based 3D geospatial pipeline that lets you upload GIS datasets (currently zipped Shapefiles), process them into PostGIS, convert them into 3D Tiles, and visualize them in a Cesium viewer.
- Project management (create, edit, view, delete projects)
- Dataset upload workflow per project
- Dataset status tracking (
uploaded,processing,completed,failed) - Layer model with visibility toggle and processing states (
pending,processing,ready,failed)
- Input format: zipped Shapefile (
.zipcontaining.shp,.shx,.dbf, and related files) - Layer types:
buildings,terrain, androads - One active dataset per layer type per project (new upload replaces previous dataset for that layer type)
- Async processing with Solid Queue jobs:
ProcessDatasetJob: validates and imports shapefile content usingogr2ogrGenerate3dTilesJob: exports processed geometries to 3D Tiles
- Geometry normalization into PostGIS feature tables (
buildings,terrains,roads) - Default extrusion heights when source height values are missing:
- Buildings:
28m - Terrain:
6m - Roads:
1m
- Buildings:
- 3D Tiles conversion through Dockerized
geodan/pg2b3dm - Versioned tileset artifacts stored under
public/tilesets/projects/:project_id/layers/:layer_id/revisions/:timestamp
- Cesium full-screen map viewer
- Layer panel with visibility toggles persisted through API
- Automatic rendering preference:
- 3D Tiles when available
- GeoJSON fallback when tiles are unavailable or not visible
- Layer metadata and features endpoints:
GET /projects/:project_id/layersPATCH /projects/:project_id/layers/:idGET /projects/:project_id/layers/:id/features
The following items are planned next (not fully implemented yet):
- Additional input formats (GeoJSON, GeoPackage, IFC, CityGML)
- Better upload and processing UX (progress indicators, retries, cancellation)
- Stronger data validation and QA (CRS checks, geometry repair reports, per-layer diagnostics)
- Advanced styling controls (material presets, thematic coloring, metadata-driven styling)
- Collaboration features (annotations, issue pins, shared views)
- Production hardening (observability, audit logs, background job scaling, automated backups)
Install these tools first:
- Ruby
- Bundler
- Node.js
- Yarn
- Docker + Docker Compose
- GDAL/OGR tools (
ogr2ogrmust be available on your PATH)
bundle install
yarn installdocker pull geodan/pg2b3dm:latestOptional runtime overrides:
export PG2B3DM_DOCKER_IMAGE=geodan/pg2b3dm:latest
export PG2B3DM_DOCKER_NETWORK=hostdocker compose up -d dbDefault development database env values:
DB_HOST=127.0.0.1DB_PORT=55432DB_USER=postgresDB_PASSWORD=postgresDB_NAME=open_construction_twin_developmentDB_QUEUE_NAME=construction_twin_development_queueDB_TEST_NAME=construction_twin_test
bin/rails db:prepareThis sets up both the primary and queue databases.
yarn build:allThis builds JavaScript and copies Cesium static assets to public/cesium.
bin/devbin/dev starts:
- Rails web server
- Solid Queue worker (
bin/jobs start) - JavaScript watcher
- Tailwind/CSS watcher
Open http://localhost:3000.
- PostGIS is required.
postgis_sfcgalis also required for full 3D extrusion behavior.- Spatial extension setup is enforced by migrations in
db/migrate.
After setup, you can verify the flow in minutes:
- Create a project from the home page.
- Upload a zipped Shapefile dataset and choose layer type.
- Wait for status transitions in the dataset card.
- Open 3D viewer and toggle the processed layer.
- Confirm
GET /projects/:project_id/layersreturns ready artifact URLs.

