trip_routing library

Classes

Edge
Graph
GraphSnap
A position projected onto the routing network.
Node
OsmClient
Thin wrapper around the public Overpass and Nominatim APIs.
RouteCosts
Cost model for pedestrian routing.
RouteResult
A routed leg between two snapped positions.
Trip
TripService
TripService provides routing and trip planning over OSM and cached city graphs.

Constants

footWayHighways → const Set<String>
highway=* values that count as dedicated walking ways.

Functions

buildGraphFromOsmElements(List elements, {int minIslandSize = 100}) → Graph
Builds a routing graph from raw Overpass elements (nodes and ways).
edgeKey(int a, int b) → (int, int)
Direction-independent key, so traversing an edge back counts as reuse.
findLatLonBounds(List<LatLng> points, {double paddingLat = 0.3, double paddingLon = 0.3, double minPaddingDegrees = 0.0}) → List<double>
Returns [minLat, minLon, maxLat, maxLon] around points.
haversineDistance(double lat1, double lon1, double lat2, double lon2) → double
isWalkable(Map tags) → bool
Whether pedestrians may use a way with the given OSM tags.
removeSmallIslands(Graph graph, int maxNodes) → void
Removes connected components with at most maxNodes nodes, except the largest component.
routeBetween(Graph graph, GraphSnap start, GraphSnap target, RouteCosts costs, {Set<(int, int)>? usedEdges}) → RouteResult?
Finds the cheapest route from start to target (A* search).
snapToEdges(Graph graph, LatLng position, Iterable<Edge> candidates, Iterable<Node> allNodes()) → GraphSnap?
Like snapToGraph, but only considers candidates; allNodes is used as a fallback when there are no candidate edges.
snapToGraph(Graph graph, LatLng position) → GraphSnap?
Projects position onto the closest segment of graph.

Exceptions / Errors

OsmRequestException
Thrown when an OSM web service (Overpass/Nominatim) request fails.