Aims. We attempt to extend the relation between the strengths of the interstellar Ca ii lines and the distances to early-type stars to objects beyond 1 kiloparsec, with the line saturation taken into account.Methods. We measure the Ca ii K and Ca ii H equivalent widths, and compute Ca ii column densities for 262 lines of sight towards early-type stars with available Hipparcos parallaxes (π). The targets are located within a few hundred parsecs of the Galactic plane, and span all the range of Galactic longitudes. We fit the N Ca ii -parallax relation with a function of the form π = 1/(a · N Ca ii + b), using a maximum-likelihood approach to take account of errors in both variables. We use the resultant formula to estimate distances to stars in OB associations and clusters, and compare them to those found in the literature, usually estimated by spectrophotometric methods. 1.3, we obtain the following approximate formula for the distance: D Ca ii = 77 + (2.78 +
Results. For lines of sight with EW(K)/EW(H) >
EW(K) EW(H) −0.932 )EW(H), where the equivalent widths EW(K) and EW(H) are in mÅ, and the distance D Ca ii in parsecs.The errors in D Ca ii , resulting from the uncertainty in the fit parameters and errors in the equivalent widths, are typically about 15% of the distance. We can also expect the equation not to hold for objects situated farther than a few hundred parsecs from the Galactic plane. We find several cases of significant column density differences between association or cluster members, especially notable in the Trumpler 16 cluster, indicating either a local contribution to the Ca ii column density, or background/foreground stars being confused with members. The ratio D Ca ii /D assoc appears to depend on the Galactic longitude, being highest in the range 70 • < l < 120 • and lowest for 200 • < l < 300 • . This effect may be due to large-scale structure being present in the Ca ii layer, or to the nonmember confusion being enhanced in these directions.