Tunnels are no different from any roadway segment(s) including bridges, viaducts, overpasses, etc. They are drawn and modified the same way as any other road using the geometry nodes to shape the roadway through the tunnel.
Theory of operation
The complication with navigation through tunnels is that generally they obscure GPS communication and cell phone data connections. The Waze servers track each mobile device (driver) as they enter and exit each segment along their route. With the start and end times of each segment, the Waze server can calculate the average speed of drivers through that segment. This is how the Waze server can determine if the tunnel traffic is flowing normally, or if there is a slowdown of the vehicles in the tunnel even without the GPS tracking information while inside the tunnel.
Some tunnels are equipped with Beacons, which can supplement the GPS signal so that location determination is possible.
In order to give adequate driving instructions, Waze permanently attempts to match each user to its location (on a segment of the map) and to its direction of travel. Waze is launching a new matching algorithm (2020) called the Falcon Snapper (FS). The new snapper is next generational – it is smarter and more predictive than the previous matcher. It uses multiple sensors including GPS, gyroscope, accelerometer (and bluetooth in tunnels) to determine the most likely position of the car in relation to the road. It’s power setting is currently turned down though. Before we can fully utilise its power, we need to make changes to our mapping standards and the Waze map. Once we finish, the power setting on FS can be turned up to the max!
When and how to use
Use the tunnel atribute only in "real" tunnels. Don't use it for bridges, viaducts, overpasses, underpasses, ecoducts. In general a tunnel segment must be at least 50m.
Split the segment at the visible (satellite) entrance/exit of the tunnel.
Some roadways through tunnels include splits or exits to other routes inside the tunnel. Creating the split is done the same as with any other junction. As described in the section above, the GPS tracking and navigation may make it difficult to know exactly where in the tunnel that turn truly exists. In the case of splits and exits, it is more important to be more accurate in the estimate of the actual roadway split or exit so the navigation directions match the roadway as closely as possible. Street View (if available in your country) can be a great help here.