Skip to content

Latest commit

History

489 Commits

Folders and files

NameName
Last commit message
Last commit date

OpenConditions

Open, federated, self-hostable live-conditions data commons — the dynamic layer that complements OpenStreetMap's static map: road incidents, roadworks, closures, hazards, and congestion today; transit occupancy, place busyness, and a crowd-sourced reporting layer later.

OpenConditions aggregates public road-condition feeds into one canonical model, stores them in PostGIS, and re-emits them in the standard wire formats the wider ecosystem already speaks. Its reference consumer is OpenMapX — the hungry first-party consumer every prior project in this space lacked — but the data and the libraries are designed to be reused anywhere.

Status

Road domain, v0.1:

  • Live feeds: NDW (NL), Die Autobahn (DE), Fintraffic / Digitraffic (FI), DriveBC (CA), and WZDx (US), spanning DATEX II, Open511, and WZDx GeoJSON — plus government point-sensor traffic speed as Measurement flow from Fintraffic (FI), WebTRIS (GB), NYC DOT (US-NY), NDW (NL), OHGO (US-OH, keyed), and Trafikverket (SE, keyed). Congestion is computed from a self-derived free-flow baseline (85th percentile), with native reference speeds where a feed ships one and OSM maxspeed as a day-one proxy. See docs/speed-coverage.md.
  • Emitters: GeoJSON, TraFF, DATEX II, GTFS-RT Alert, JSON-LD, Valhalla exclusions, and an SSE stream — all public, rate-limited, and bbox-filterable.
  • OpenMapX integration: ships as an installable extension (a service + a provider integration).
  • TMC location tables: publishers that send Alert-C location codes instead of coordinates are placed against the published national table (Germany's LCL 22.0, CC BY 4.0), behind a strict table-version guard. See docs/tmc-location-tables.md.
  • OpenLR resolver: built and tested, but dormant — no open feed currently carries OpenLR (the open feeds use coordinates or Alert-C/TMC). It activates when an OpenLR-bearing source is configured.

Architecture

A two-axis canonical model — every record is an Observation, either a ConditionEvent (an incident, closure, …) or a Measurement (a flow speed, …) — stored in a single generic conditions.observations PostGIS table. Three layers:

packages/ reusable libraries (Apache-2.0)
core/ canonical model, severity, freshness, read helpers, DB schema/migrations (./server)
roads/ road-domain parsers (DATEX II / Open511 / WZDx) + feed registry + TMC location tables
publishers/ outbound emitters (GeoJSON, TraFF, DATEX II, GTFS-RT, JSON-LD, Valhalla)
openlr/ OpenLR binary decode + resolver client
services/ deployable services
ingest/ Fastify: fetch → parse → atomic PostGIS swap + public emitter feeds; ships
the OpenMapX service.json so `repos add` can install it (AGPL-3.0)
openlr-resolver/ Python/FastAPI OpenLR → geometry map-matcher (dormant)
integrations/
road-conditions-openconditions/ OpenMapX provider integration (reads observations back into the map)

The ingest service owns and migrates the conditions schema itself, idempotently, on boot.

Quick start

Requires Node 24+ and pnpm 11+ (and a reachable PostGIS).

pnpm install
pnpm build
DATABASE_URL=postgres://postgres:postgres@localhost:5432/openconditions \
pnpm --filter @openconditions/ingest dev

The service applies its migrations, starts polling the enabled feeds, and serves on :4100.

Public emitter feeds

All are bbox-filterable (?bbox=west,south,east,north[&domain=roads]) and rate-limited:

EndpointFormat
GET /observations.geojsonGeoJSON FeatureCollection
GET /observations.jsonldJSON-LD (SOSA/Schema.org @context)
GET /traff.xmlTraFF (CoMaps / Navit)
GET /datex2/situations.xmlDATEX II v3 SituationPublication (status)
GET /gtfs-rt/alerts.pbGTFS-RT Alert (protobuf)
GET /valhalla/exclusions.jsonValhalla exclude_locations / exclude_polygons
GET /streamServer-Sent Events (snapshot + live deltas)
GET /statushealth (unlimited)

Using OpenConditions with OpenMapX

OpenConditions installs into an OpenMapX deployment as a community extension:

pnpm openmapx repos add https://github.com/openconditions/openconditions
pnpm openmapx services enable openconditions-ingest
pnpm openmapx compose render && pnpm openmapx compose up
# then install the road-conditions-openconditions provider integration artifact

See OpenMapX's Building an external extension guide for the full flow. The ingest writes to the shared PostGIS conditions schema; the provider integration reads it back into the OpenMapX map overlay and routing avoidance.

Crowd reporting

Pseudonymous contributors can augment the official feeds with signed road-condition reports. Read what crowd reporting is — and the guarantees we deliberately do NOT make before relying on it.

Published artifacts

  • npm: @openconditions/core, @openconditions/roads (prebuilt, public)
  • images: ghcr.io/openconditions/ingest, ghcr.io/openconditions/openlr-resolver
  • static archive: a nightly GeoParquet snapshot of the published view — the mirrorable artifact for seeding a new instance or backfilling a federation peer (license/expiry/tombstone enforced, no raw crowd evidence, no probe staging)

Releases are cut by tagging vX.Y.Z (see .github/workflows/release.yml).

License

A two-license split — see LICENSING.md:

  • AGPL-3.0-or-later — the ingest service (the deployable network commons server).
  • Apache-2.0 — the reusable @openconditions/* libraries, the OpenMapX provider integration, and the standalone OpenLR resolver.
  • Source data keeps each feed's upstream license (CC0 / CC-BY / dl-de/by / OGL / …); OSM-derived data is ODbL. Observations carry their source_license, and the emitters can filter share-alike-incompatible records out of permissive exports.

Contributing

See CONTRIBUTING.md for development setup and the quality bar, SUPPORT.md for where to ask questions, and the Code of Conduct. Contributions are accepted under a CLA.

Releases

Packages

Used by

Contributors

Languages