GEO-INFER-TRANSPORT
Instructions
Core Capabilities
- Network analysis (
TransportNetwork): build from edge lists, connectivity components/reachability/critical links, centrality, statistics, subgraph extraction - Routing (
RoutingEngine): Dijkstra / A* / Bellman-Ford, traffic-adjusted weights, OD matrices, alternative routes - Traffic analysis (
TrafficAnalyzer): BPR congestion modeling, LOS classification, microsimulation, EWMA forecasting with confidence intervals, incident detection - Accessibility (
AccessibilityAnalyzer): isochrones, service areas, equity analysis - Transit planning (
TransitOptimizer): frequency optimization, coverage analysis with demographic equity, network design, scenario evaluation
Key Imports
from geo_infer_transport import (
TransportNetwork,
RoutingEngine,
TrafficAnalyzer,
AccessibilityAnalyzer,
TransitOptimizer,
)
Examples
from geo_infer_transport import (
TrafficAnalyzer,
TransportNetwork,
RoutingEngine,
)
# Build a network and route on it
network = TransportNetwork(network_type="road")
network.build_from_edges(
[
{"id": "e1", "from": "n1", "to": "n2", "length_m": 1000, "speed_limit": 50},
{"id": "e2", "from": "n2", "to": "n3", "length_m": 800, "speed_limit": 40},
]
)
router = RoutingEngine(network=network, algorithm="dijkstra")
route = router.route({"node_id": "n1"}, {"node_id": "n3"})
print(route.total_distance_m, route.total_time_s) # check route.route_source
# Traffic simulation and forecasting are methods of TrafficAnalyzer
analyzer = TrafficAnalyzer(model_type="bpr", time_resolution="15min")
demand = {"matrix": [[100, 50], [30, 80]]}
simulation = analyzer.simulate_traffic(
network=network, demand_matrix=demand, simulation_hours=1, time_step_seconds=60
)
print(f"Completed trips: {simulation['statistics']['completed_trips']}")
forecast = analyzer.forecast_traffic(
[{"volume": 1000}, {"volume": 1100}, {"volume": 950}], forecast_horizon="1h"
)
print(f"Forecast points: {len(forecast['forecasts'])}")
Agent interfaces
Use uv run --frozen geo-infer catalog TRANSPORT to discover public source
APIs, then geo-infer describe before calling a selected target. Scripts use
geo_infer_api.agent_runtime.AgentSession; the optional stdio MCP server is
geo-infer-mcp. See requests, native objects and composition.
The adapter retains this module's dependencies and authorization requirements.
Guidelines
simulate_trafficuses the real BPR delay function;forecast_trafficuses EWMA + trend estimation with widening prediction intervals.forecast_horizonstrings must be a number plus an s/m/h/d unit (e.g."30m","90m","1h","1d") and must span at least onetime_resolutioninterval; anything else raisesValueError.- Routing fallback semantics:
Route.route_sourceis"network"when computed on the graph,"estimated_fallback"when no network is set (haversine estimate). When no path exists on the network, the returned Route has an emptypathand zero distance/time — checkroute_sourcebefore trusting metrics. - Missing-node routing: if the origin or destination node is not present in the graph,
route()andcalculate_isochrone()degrade instead of raising —route()returns an empty-path Route (route_source == "network", zero distance/time) and the isochrone degenerates to the origin node only. TrafficAnalyzeraccepts onlymodel_type="bpr"(the implemented BPR delay model); any other value raisesValueError.simulate_trafficraisesValueErrorfortime_step_seconds <= 0.route()takes onlyorigin,destination, andoptimization— there are no mode/avoid/via parameters.- Emissions calculation lives in GEO-INFER-LOG (
geo_infer_log.core.transport.EmissionsCalculator), not in this module. Install thelogextra (uv sync --package geo-infer-transport --extra log;pip install geo-infer-transport[log]is not available yet, since the distribution is not published to PyPI) to enable the guarded critical-links integration inTransportNetwork.analyze_connectivity(method="critical_links"). - Test:
uv run python GEO-INFER-TEST/run_unified_tests.py --module TRANSPORT
Integrations
- LOG (optional
logextra): edge-betweenness critical-link identification viaTransportationNetworkAnalyzer; the standalone EmissionsCalculator also lives there - SPACE / DATA / ECON / EMERGENCY / HEALTH: recommended prerequisites (see frontmatter); no code-level imports exist today