Let K̂ be the field of formal Laurent series in X−1 over the finite field k, and let A be the ring of polynomials in X over k. One of the main results of the paper is to give a natural coding of the (discrete) geodesic flow on the quotient of the Bruhat–Tits tree 𝕋 of PGL2(K̂) by PGL2(A), using the continued fraction expansion of the endpoints of the geodesic lines in 𝕋 (the space of ends of 𝕋 identifies with ℙ 1(K̂). In particular, the invariance of the Haar measure by the Artin transformation can be deduced from the invariance of the Bowen–Margulis measure by the geodesic flow.