Merge pull request #11 from zvx-echo6/feat/locate-verbose

fix(offroute): _locate_on_network sets verbose=true; reads edge_info.classification.classification
This commit is contained in:
malice 2026-05-24 20:58:35 -06:00 committed by GitHub
commit 21cd810272
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -537,7 +537,7 @@ class OffrouteRouter:
try:
resp = requests.post(
f"{VALHALLA_URL}/locate",
json={"locations": [{"lat": lat, "lon": lon}], "costing": costing},
json={"locations": [{"lat": lat, "lon": lon}], "costing": costing, "verbose": True},
timeout=10
)
@ -553,7 +553,9 @@ class OffrouteRouter:
"snap_distance_m": snap_dist,
"snapped_lat": snap_lat,
"snapped_lon": snap_lon,
"road_class": edge.get("road_class"),
# Valhalla puts the highway class under edge.classification.classification
# (verbose=true); defensive .get chain so missing keys yield None.
"road_class": edge.get("edge", {}).get("classification", {}).get("classification"),
}
except Exception:
pass