The Problem
OpenStreetMap (OSM) contains rich infrastructure data—power lines, substations, telecoms, water networks—but no dedicated way to visualize it. OpenInfraMap solves this by rendering that data as an interactive map at openinframap.org, turning raw OSM tags into a browsable, filterable view of global infrastructure.
What This Does
The repo is a collection of five self-contained projects, not a monolith: web/ (TypeScript/React frontend), web-backend/ (Python FastAPI-style server), schema/ (PostgreSQL views and functions), imposm/ (Python mapping OSM data into Postgres), and tegola/ (vector tile generation). Each has its own Dockerfile and CI workflow.
The pipeline is: imposm imports OSM PBF files into Postgres, schema/ defines the SQL views that shape that data, tegola serves vector tiles, web-backend provides a stats/chart API, and web renders the map. docker-compose.yml ties the services together.
How It Is Wired
Execution starts in two places. imposm/main.py is the import entry point—it maps OSM elements into database tables via funcs.py (functions like table, relation_tables, generalized_table). web-backend/main.py starts the web server; its main function reaches 5 downstream functions and touches the database via refresh_matviews using psycopg.connect.
The highest fan-in functions are result_to_df and figure (each called from 6 places), both in web-backend/charts/util.py—change these and the charting layer breaks broadly. latest_stats_date in web-backend/data.py is also called from 6 places. tegola/expire.py is the only file that runs an external command and writes files, handling tile expiry and directory cleanup.
The module graph shows a cycle in web/src/search/ (search.ts, coordinates.ts, opencage.ts)—mutually reachable imports that complicate refactoring. Two oversized files, web/src/style/style_oim_power.ts and style_base.ts (1,247 lines each), carry the visual styling logic and will be painful to modify.
How To Use It
Setup: docker-compose up is the intended path—each service has a Dockerfile. For local development, web/ uses npm (package.json present), web-backend/ uses pip/uv (pyproject.toml).
Configuration: The README does not document environment variables or setup steps beyond pointing to docs/architecture.md. Database credentials and connection strings are not documented in the repo.
Running it: No single entry point is documented. The README is 1,463 bytes and says only "see the architecture documentation"—which is absent from the file listing. This is the repo's biggest usability gap.
Real-World Use
A typical deployment: imposm ingests a regional OSM extract, schema/refresh_matviews.sql rebuilds materialized views on a schedule (covered by schema/jobs/update-stats.sql), tegola serves tiles to the React frontend, and web-backend answers chart requests like plant_count or line_length from web-backend/charts/. The web-router directory (3 files) likely handles routing between these services.
Code Health & Issues
Static analysis found 9 issues: 5 high, 4 medium. The import cycle in web/src/search/ is the only high-severity soundness problem. Two oversized files in web/src/style/ add cognitive load. Medium issues include 12 duplicated 6-line code blocks across 8 files, and deep nesting (depth 6) in web-backend/charts/country.py and views/area.py.
SDLC gaps: CI workflows use unpinned GitHub Actions tags (docker/login-action@v4)—a tag can be moved, risking supply-chain compromise. No permissions: block in 4 workflows, no Dependabot config, and python:3.12-slim in imposm/Dockerfile is unpinned by digest. Only 2 test files cover 63 source files (ratio 0.032). No .editorconfig or formatter config.
The Bottom Line
A production-grade infrastructure map with a sound three-tier architecture (import → tile → web) and clean separation between projects. The code is real and working—this is not a toy. The main weaknesses are documentation (no run instructions), weak CI hardening, and a thin test suite. Use it if you need to visualize OSM infrastructure data; expect to invest in docs and tests before production.