<< All versions

Skill v1.0.0

currentAutomated scan100/100
kendrick-oppong/geoskills/routing-network-analysis
──Details
PublishedOctober 25, 2026 at 06:26 AM
Content Hashsha256:cea036ec677f7154...
Git SHA77bd91343bcb
──Files
Files (1 file, 4.9 KB)
SKILL.md4.9 KBactive
SKILL.md · 64 lines · 4.9 KB

version: "1.0.0" name: routing-network-analysis description: Use when building routing, shortest-path, isochrone, or network analysis features — choosing between OSRM, Valhalla, GraphHopper, or pgRouting; network graph preparation from vector data; and common routing-graph data pitfalls.


Routing & Network Analysis

When to use this skill

  • "Add turn-by-turn directions / travel time / isochrones to the app"
  • Building a custom routing graph from raw road-network vector data
  • Debugging routes that take an obviously wrong path or fail to route at all between two nearby points

Decision framework

ToolBest forNotes
OSRMVery fast car routing at scale, simple use casesContraction hierarchies give sub-millisecond queries; less flexible for multi-modal or complex custom costing
ValhallaMulti-modal (car/bike/pedestrian/multi-leg), customizable costing models, isochronesMore configurable cost functions than OSRM; slightly more operational complexity
GraphHopperSimilar niche to Valhalla, Java-based, good for custom vehicle profilesChoose based on team's existing stack/language comfort and licensing (GraphHopper has both OSS and commercial tiers)
pgRoutingRouting that needs to live inside existing PostGIS infrastructure, or custom/non-road networks (utility networks, trails, custom graphs)Good when the network isn't standard OSM roads (e.g., an internal facility network, sewer/utility network) or when tight integration with other PostGIS data is more valuable than raw routing speed

Default: for standard road-network routing at product scale, OSRM or Valhalla (self-hosted from OSM extracts) over building custom routing logic — this is a solved problem with mature open tooling; don't reinvent shortest-path/contraction-hierarchy logic. Use pgRouting specifically when the network is non-standard or routing needs to be one query among many in an existing PostGIS-based data model.

Checklist

  • [ ] Is the underlying network graph properly noded — do line segments that visually touch actually share an exact coincident vertex? (see geodata-qaqc) Unconnected segments silently break routability between apparently-adjacent roads.
  • [ ] Are one-way restrictions, turn restrictions, and access restrictions (e.g. no-entry, vehicle-class restrictions) correctly encoded in the source data before it's fed to the routing engine — missing these produces routes that are illegal or physically impossible.
  • [ ] Is the routing profile (car/bike/pedestrian/etc.) using an appropriate cost function — travel time weighting differs meaningfully from pure distance, especially for realistic ETAs.
  • [ ] For isochrone (travel-time polygon) features, is the isochrone tool's resolution/simplification setting tuned — overly coarse isochrones look blocky and can materially misrepresent reachable area.
  • [ ] Is graph data refreshed on a defined cadence (OSM changes constantly) — a stale routing graph will route through closed roads or miss new ones.
  • [ ] For multi-modal trips (e.g., walk + transit + bike), is the tool actually multi-modal-capable (Valhalla) rather than force-fitting a single-mode engine?

Common pitfalls

  • Unconnected road segments from digitizing/import artifacts: two roads that touch visually on a map but don't share a vertex are invisible to a routing graph — always validate topology, not just visual appearance, before building a routable graph.
  • Ignoring turn restrictions in custom-built graphs: produces routes with illegal U-turns or maneuvers the underlying regulations forbid — critical for any commercial routing product.
  • Treating routing distance as equivalent to travel time: shortest-distance and fastest-time routes frequently diverge meaningfully (e.g., a longer highway route beats a shorter but slow local-road route) — pick the cost function deliberately per use case.
  • Rebuilding the entire routing graph on every minor data update: expensive; most tools support incremental updates or at least a scheduled full rebuild rather than on-demand rebuilding per request.
  • Using pgRouting for continent-scale, high-QPS car routing: works, but will generally be slower than a purpose-built contraction-hierarchy engine (OSRM/Valhalla) at that scale — reserve pgRouting for custom/smaller networks or when integration convenience outweighs raw speed.

Reference snippets

bash
# OSRM: build + serve a routable graph from an OSM extract
osrm-extract -p car.lua region.osm.pbf
osrm-contract region.osrm
osrm-routed region.osrm
sql
-- pgRouting: shortest path on a custom network table
SELECT * FROM pgr_dijkstra(
'SELECT id, source, target, cost FROM network_edges',
start_node, end_node
);

Related skills

  • geodata-qaqc — network topology validation before building a routing graph
  • postgis-geospatial — pgRouting's underlying database layer
All versions