← Back to all projects

Maps

Maps project screenshot

A complete self-hosted mapping and routing platform providing a fully private alternative to commercial mapping solutions. Features Docker-orchestrated microservices, OSRM routing engine, Nominatim geocoding, Leaflet-based map interface, and Flask API layer—all running entirely offline for secure internal networks.

Technology

frontendhtmljavascriptleaflet
backendpythonflask
devopsdockerapacheosrmnominatim
toolsopenstreetmap

🗺️ Local Web Map & OSRM Routing Platform

Long-Form Project Summary for KNWS Showcase

This project is a complete self-hosted mapping and routing platform built using Docker-orchestrated components, OSRM routing, Leaflet-based map rendering, and a Flask-backed API layer. It provides a fully private, high-performance alternative to commercial mapping solutions such as Google Maps—ideal for internal corporate networks, secure environments, or custom geospatial applications.

The system integrates fully offline routing, geocoding, and map display while being modular enough to support custom map tiles, additional data sources, or specialised navigation logic.


🚀 Project Goals

  1. Deploy an entirely self-contained mapping service without relying on Google, Mapbox, or external APIs.
  2. Use Docker containers to cleanly separate routing, geocoding, tile-serving, and web components.
  3. Provide fast, offline routing via OSRM (Open Source Routing Machine).
  4. Expose a unified API layer through Flask so that the mapping engine can be consumed by other internal systems.
  5. Offer an intuitive, interactive map interface for route planning, address lookup, and geospatial exploration.
  6. Run reliably on local infrastructure, inside a private LAN environment.

🧠 Core Features

1. Interactive Map Interface (Leaflet)

The frontend uses Leaflet, a lightweight and flexible JavaScript mapping library, to deliver:

  • Smooth map panning and zooming
  • Marker placement
  • Route overlays
  • Distance/route summaries
  • Popup info windows

Because the system is self-hosted, all tiles and data are served from your own infrastructure.


2. High-Performance Routing Engine (OSRM)

OSRM (Open Source Routing Machine) runs inside a dedicated Docker container and provides:

  • Lightning-fast turn-by-turn route generation
  • Car, foot, or cycling profiles
  • Polyline route output for map display
  • Distance and duration calculations
  • Support for locally hosted OpenStreetMap (OSM) extracts

The routing pipeline preprocesses the OSM file into .osrm datasets for near-instant routing performance.


3. Address Geocoding (Nominatim)

A stand-alone Nominatim container enables:

  • Forward geocoding (address → coordinates)
  • Reverse geocoding (coordinates → nearest address)
  • Full offline capability
  • Consistent, private geolocation services

This is ideal for internal corporate applications where cloud APIs are not permitted.


4. Flask API Layer

The Flask application sits between the frontend and the containerised services, offering a unified interface:

  • /route → queries OSRM for optimal routes
  • /geocode → address lookup via Nominatim
  • /reverse → coordinate-to-address conversion
  • /tiles/... → tile serving if using custom tile containers
  • Authentication or logging hooks (optional)

This makes the system easily reusable as a backend for:

  • Fleet management
  • GIS tooling
  • Navigation devices
  • Custom logistic or delivery software

5. Docker-Based Microservice Architecture

Every subsystem runs in its own Docker container:

  • map_frontend → Leaflet + static files
  • api_server → Flask application
  • osrm_backend → OSRM routing engine
  • nominatim → geocoding service
  • tile_server → optional custom tile server

This ensures:

  • Isolation between modules
  • Easy upgrades
  • Reproducible builds
  • Clean deployment to new servers

The entire system can be rebuilt or relocated using a single docker-compose.yml.


6. Apache2 Frontend Integration

An Apache2 reverse proxy exposes the application to users on your LAN:

  • SSL termination (optional)
  • URL routing (e.g., /api, /tiles, /map)
  • Load balancing or caching layers (if added)

This gives the map platform a stable, production-ready entry point.


🛠 Technical Architecture

Server Environment

  • Ubuntu Server
  • Apache2 (reverse proxy / static hosting)
  • Docker + Docker Compose
  • LAN routing at: 192.168.10.10

Folder Structure

  • /frontend → Leaflet UI
  • /backend → Flask API
  • /routing → OSRM extraction and pre-processing scripts
  • /data → OSM map extracts
  • /docker → container definitions

🔧 Pipeline & Workflow

  1. Download OSM map data (e.g., regional extract).
  2. Pre-process the extract using OSRM tools: osrm-extract, osrm-partition, osrm-customize.
  3. Build containers using Docker Compose.
  4. Start the environment: OSRM, Nominatim, Flask, map frontend.
  5. Serve via Apache2 for user access.
  6. Use the browser to search addresses, calculate routes, explore map tiles.

Everything runs fully offline and can be hosted in air-gapped environments.


📈 Outcome & Impact

This project demonstrates advanced capability in:

  • Geospatial systems
  • Docker microservice architecture
  • Routing and navigation algorithms
  • Backend API design
  • Frontend map visualisation (Leaflet)
  • Offline geocoding and mapping
  • Self-hosted infrastructure and DevOps
  • Apache2 integration & reverse proxy workflows

The final product is a robust, private alternative to commercial mapping platforms that can be deployed internally for logistics, planning, fleet management, surveying, or general geospatial development.