Navigation banner across the top (the next maneuver's arrow by Valhalla's type, distance, street, then…, lanes, the street being driven; maneuvers gain type/street/exit); the driving view (tilted to 3D) hides route numbers and minor roads' names, road labels further apart
This commit is contained in:
1 parent
e62eb90dc7
commit
27313b3101
7 files changed
+144
-22
No files matched your search
@@ -256,11 +256,18 @@ module Maptool
|
||||
speed_limits: along[:speed_limits], signals: along[:signals],
|
||||
legs_km: legs.map { |leg| leg.dig("summary", "length") }, # to each via point, for rerouting
|
||||
# lanes: Valhalla's [{directions:, valid:, active:}] bitmasks, at junctions that have them
|
||||
maneuvers: legs.flat_map { |leg| leg["maneuvers"].map { |m| { text: m["instruction"], km: m["length"], lanes: m["lanes"] }.compact } } } }
|
||||
# type: Valhalla's maneuver type (the arrow), street: the road it leads onto
|
||||
maneuvers: legs.flat_map { |leg| leg["maneuvers"].map { |m| maneuver(m) } } } }
|
||||
rescue ArgumentError, TypeError
|
||||
raise RouteError, "invalid coordinates"
|
||||
end
|
||||
|
||||
def self.maneuver(m)
|
||||
{ text: m["instruction"], km: m["length"], type: m["type"], street: (m["begin_street_names"] || m["street_names"])&.first,
|
||||
exit: m["roundabout_exit_count"], lanes: m["lanes"] }.compact
|
||||
end
|
||||
private_class_method :maneuver
|
||||
|
||||
# From Valhalla's per-edge attributes along the route:
|
||||
# countries: [{ code: "AT", km:, motorway_km:, toll_km: }, ...] in route
|
||||
# order (vignettes, tolls);
|
||||
|
||||
Reference in new issue
Block a user