We present a new fully data-driven algorithm that uses photometric data from the Canada-France-Imaging-Survey (CFIS; u), Pan-STARRS 1 (PS1; griz), and Gaia (G) to discriminate between dwarf and giant stars and to estimate their distances and metallicities. The algorithm is trained and tested using the SDSS/SEGUE spectroscopic dataset and Gaia photometric/astrometric dataset. At [Fe/H]< −1.2, the algorithm succeeds in identifying more than 70% of the giants in the training/test set, with a dwarf contamination fraction below 30% (with respect to the SDSS/SEGUE dataset). The photometric metallicity estimates have uncertainties better than 0.2 dex when compared with the spectroscopic measurements. The distances estimated by the algorithm are valid out to a distance of at least ∼ 80 kpc without requiring any prior on the stellar distribution, and have fully independent uncertainities that take into account both random and systematic errors. These advances allow us to estimate these stellar parameters for approximately 12 million stars in the photometric dataset. This will enable studies involving the chemical mapping of the distant outer disc and the stellar halo, including their kinematics using the Gaia proper motions. This type of algorithm can be applied in the Southern hemisphere to the first release of LSST data, thus providing an almost complete view of the external components of our Galaxy out to at least ∼ 80 kpc. Critical to the success of these efforts will be ensuring well-defined spectroscopic training sets that sample a broad range of stellar parameters with minimal biases. A catalogue containing the training/test set and all relevant parameters within the public footprint of CFIS is available online.