Measurement of the spatial coherence of a trapped Bose gas at the phase transition