We present an unexpected connection between two map enumeration problems. The first one consists in counting planar maps with a boundary of prescribed length. The second one consists in counting planar maps with two points at a prescribed distance. We show that, in the general class of maps with controlled face degrees, the solution for both problems is actually encoded into the same quantity, respectively via its power series expansion and its continued fraction expansion. We then use known techniques for tackling the first problem in order to solve the second. This novel viewpoint provides a constructive approach for computing the so-called distance-dependent two-point function of general planar maps. We prove and extend some previously predicted exact formulas, which we identify in terms of particular Schur functions.