GIS workflow comparing two real Oakland–San Jose routes: the shortest path via Niles Canyon (East Bay Hills, +302m elevation gain) vs. the energy-optimal route via the flat I-880 bay corridor. SRTM terrain data and NREL H₂ station locations quantify the trade-off between distance and fuel consumption.
Energy-optimal route via I-880 (orange) vs. shortest-distance route via Niles Canyon (gray). Green circles are real NREL-reported H₂ stations. The two routes are nearly the same distance. The difference is entirely terrain. Dashed blue markers show where each route passes within range of a station.
The road network is fetched from OpenStreetMap via OSMnx, filtered to major roads (motorway, trunk, primary, secondary). Each node gets an SRTM elevation from the Open-Elevation API; edge grades are computed from adjacent node elevation differences.
Edge weights: weight = (dist_miles + elev_gain_m / 25) × H₂_kg_per_mile. NetworkX Dijkstra finds the minimum-energy path. The two routes cover nearly the same distance (43.8 mi vs. 43.7 mi). The Niles Canyon route climbs 302m vs. just 43m on I-880.
Result: the energy-optimal route consumes 18.8% less hydrogen despite being the same length. Flat terrain beats shorter distance when the grade penalty is steep enough.
Elevation profiles for both routes overlaid. The orange line (I-880, energy-optimal) hugs sea level at 10–30m for the full 43.7 miles. The gray dashed line (Niles Canyon, shortest-distance) climbs through the East Bay Hills to a 330m peak before descending to Fremont, adding 302m of effective uphill work that directly translates to extra hydrogen consumption.
Operational H₂ stations are pulled from the NREL Alternative Fuels Station Locator API (real stations, not synthetic data). 7 stations appear in the Bay Area corridor (True Zero network + Shell). The route is sampled every 500m and the distance to the nearest station is computed in EPSG:3310 (California Albers).
At a 30-mile conservative threshold (appropriate for hydrogen buses in hilly terrain), the Bay Area portion of this corridor is fully covered. The True Zero network provides continuous coverage. This is actually a meaningful finding: the corridor is infrastructure-ready for hydrogen fleet deployment today.
Dotted green lines show where each station projects onto the route. The chart structure generalizes to any corridor where coverage gaps would emerge.
Candidate new station sites are placed at midpoints of coverage gap segments. Candidates are filtered by two spatial constraints: road grade ≤ 5% (flat terrain lowers construction cost and improves heavy-vehicle access) and minimum 10-mile inter-site spacing. The Bay Area corridor at a 30-mile threshold shows no gaps; the siting algorithm is designed to trigger on longer or underserved corridors where gaps do exist.
End-to-end spatial optimization pipeline. Each step uses real external data sources; the analysis is fully reproducible from the Jupyter notebook.
OSMnx
→
SRTM ElevationOpen-Elevation
→
Energy WeightsNetworkX
→
Optimal RouteDijkstra
→
NREL StationsREST API
→
Coverage GapsGeoPandas
→
SitingConstraints
Fetches the drivable road network within the Oakland–San Jose bounding box, filtered to major road types via ["highway"~"motorway|trunk|primary|secondary|..."]. Graph is simplified to merge parallel edges and remove intermediate degree-2 nodes.
Batch-queries SRTM 30m elevation data for every node in the graph. SRTM (Shuttle Radar Topography Mission, NASA 2000) provides near-global terrain coverage at 30m resolution, a real remote sensing product. Edge grades are computed from adjacent node elevation differences.
Each edge gets energy_cost = (dist_miles + elev_gain_m / 25) × (1/60). The 25m constant comes from empirical H₂ vehicle efficiency data: 25m elevation gain ≈ 1 extra effective mile of consumption. NetworkX finds the shortest path on this energy graph.
Pulls all operational (status=E) hydrogen (fuel_type=HY) stations in California. The route is sampled every 500m and for each sample point the distance to the nearest station is computed in projected EPSG:3310 (California Albers). Coverage threshold: 30 miles (conservative for heavy vehicles on varied terrain).
Contiguous gap segments are identified and midpoints become candidate sites. Grade at each candidate is computed from incident edge grade_abs values from the OSM graph. Candidates failing grade > 5% or spacing < 10 mi are eliminated. Remaining candidates are ranked by distance from nearest existing station.