How lddl/horizon works
Horizon turns prepared OpenStreetMap road-graph CSVs into a queryable routing and map-matching service. At startup, the server loads the graph and spatial edge data; clients then submit GPS traces or route/isochrone requests through REST, with gRPC available as an optional API. Map matching searches for nearby road candidates and evaluates likely paths; routing and isochrone operations use the graph to produce results. The README documents these capabilities, while only selected implementation excerpts were available, so uncertain internal call links are omitted.
Main entry points: map_matcher.go Map matcher · map_engine.go Map engine · main.go Server startup · service.go gRPC service
Components 23
Graph loading
- Prepared graph CSVs
- Map engine
map_engine.go - CSV column lookup
csv_lookup.go - Edge cost resolution
cost_resolver.go
Routing core
- Road graph
edge_graph.go - CH query graph
- Spatial edge index
spatial/storage.go - Road geometry
spatial/edge.go - Isochrone computation
isochrones_wrapper.go
Service APIs
- Server startup
cmd/horizon/main.go - REST map match
rest/map_match.go - REST shortest path
rest/shortest_path.go - REST isochrones
rest/isochrones.go - gRPC service
rpc/service.go - gRPC map match
rpc/map_match.go - gRPC shortest path
rpc/shortest_path.go - gRPC isochrones
rpc/isochrones.go
Map matching
- Map matcher
map_matcher.go - GPS measurements
gps_measurement.go - Road candidates
candidates.go - HMM probabilities
hmm_probabilities.go - Match results
map_matcher_result.go
Other components
- API client
Connections 31
- Prepared graph CSVs → Map engine: loads
- Map engine → CSV column lookup: reads headers
- Map engine → Edge cost resolution: resolves costs
- Map engine → Road graph: builds graph
- Map engine → Spatial edge index: indexes edges
- Map engine → Road geometry: loads geometry
- API client → REST map match: posts trace
- API client → REST shortest path: requests route
- API client → REST isochrones: requests area
- Server startup → Map engine: loads graph
- Server startup → REST map match: registers handler
- Server startup → REST shortest path: registers handler
- Server startup → REST isochrones: registers handler
- REST map match → Map matcher: runs matching
- Map matcher → GPS measurements: uses observations
- Map matcher → Spatial edge index: searches nearby
- Map matcher → Road candidates: generates candidates
- Map matcher → HMM probabilities: scores paths
- Map matcher → Match results: returns matches
- REST shortest path → Map matcher: queries route
- REST isochrones → Map matcher: queries area
- Map matcher → Road graph: queries graph
- Road graph → CH query graph: uses CH routing
- Map matcher → Isochrone computation: computes isochrones
- Server startup → gRPC service: optionally starts
- gRPC service → gRPC map match: dispatches RPC
- gRPC service → gRPC shortest path: dispatches RPC
- gRPC service → gRPC isochrones: dispatches RPC
- gRPC map match → Map matcher: runs matching
- gRPC shortest path → Map matcher: queries route
- gRPC isochrones → Map matcher: queries area