  Combining the precise parallaxes and optical photometry delivered by Gaia's
second data release (Gaia DR2) with the photometric catalogues of PanSTARRS-1,
2MASS, and AllWISE, we derive Bayesian stellar parameters, distances, and
extinctions for 265 million stars brighter than G=18. Because of the wide
wavelength range used, our results substantially improve the accuracy and
precision of previous extinction and effective temperature estimates. After
cleaning our results for both unreliable input and output data, we retain 137
million stars, for which we achieve a median precision of 5% in distance, 0.20
mag in V-band extinction, and 245 K in effective temperature for G<14,
degrading towards fainter magnitudes (12%, 0.20 mag, and 245 K at G=16; 16%,
0.23 mag, and 260 K at G=17, respectively). We find a very good agreement with
the asteroseismic surface gravities and distances of 7000 stars in the Kepler,
the K2-C3, and the K2-C6 fields, with stellar parameters from the APOGEE
survey, as well as with distances to star clusters. Our results are available
through the ADQL query interface of the Gaia mirror at the Leibniz-Institut
f\"{u}r Astrophysik Potsdam (gaia.aip.de) and as binary tables at data.aip.de.
As a first application, in this paper we provide distance- and
extinction-corrected colour-magnitude diagrams, extinction maps as a function
of distance, and extensive density maps, demonstrating the potential of our
value-added dataset for mapping the three-dimensional structure of our Galaxy.
In particular, we see a clear manifestation of the Galactic bar in the stellar
density distributions, an observation that can almost be considered a direct
imaging of the Galactic bar.
