  Ground-based astro-geodetic observations and atmospheric occultations, are
two examples of observational techniques requiring a scrutiny analysis of
atmospheric refraction. In both cases, the measured changes in observables are
geometrically related to changes in the photon path and the light time of the
received electromagnetic signal. In the context of geometrical optics, the
change in the physical properties of the signal are related to the refractive
profile of the crossed medium. Therefore, having a clear knowledge of how the
refractivity governs the photon path and the light time evolution is of prime
importance to clearly understand observational features. Analytical studies
usually focused on spherically symmetric atmospheres and only few aimed at
exploring the effect of the non-spherical symmetry on the observables. In this
paper, we analytically perform the integration of the photon path and the light
time of rays traveling across a planetary atmosphere. We do not restrict our
attention to spherically symmetric atmospheres and introduce a comprehensive
mathematical framework which allows to handle any kind of analytical studies in
the context of geometrical optics. To highlight the capabilities of this new
formalism, we carry out five realistic applications for which we derive
analytical solutions. The accuracy of the method of integration is assessed by
comparing our results to a numerical integration of the equations of
geometrical optics in the presence of a quadrupolar moment $J_2$. This shows
that the analytical solution leads to the determination of the light time and
the refractive bending with relative errors at the level of one part in $10^8$
and one part in $10^5$, for typical values of the refractivity and the $J_2$
parameter at levels of $10^{-4}$ and $10^{-2}$, respectively.
