Generating a UV map from object generated texture coordinates
Spherical Coordinates



The pictured above part of node setup from https://blender.stackexchange.com/a/148354/15543  (refined from https://blender.stackexchange.com/a/159492/15543)

produces spherical coordnates (r, theta, phi) from object texture coordinate (x, y, z)   Equirectangular coordinates map latitude to U and longitude to V .. (or is it vice versa) and are recognizable from their 2 x 1 aspect ratio image.

The angles are in radians.  360 degrees = 2pi radians.

The latitude is mapped to [-pi/2, pi/2] the longitude [-pi, pi]  mapping both to [0, 1] by dividing by range (pi for  latitude and  2 * pi for longitude) and adding 0.5  will produce Equirectangular UV coordinates to plug into a texture node.

Note the mapping node is not required, but can be used to alter the meridian for example.

Alternatively could use vector maths and input up and zero meridian vectors.

Texture Painting

If we set up a sphere from a grid, or plane as described here  

How to animate morphing a rectangular plane into a sphere  in particular using method for 2.8 used here https://blender.stackexchange.com/a/24053/15543

poles are nicely collapsed to a point, and the UV is a perfect quad.
Hence  can texture paint on our sphere to an Equirectangular projection image.


First time texture painting.. but in the right spots

Note: Made the grid 2x in x dimension. Empty rotated (90, 0, 90) the simple deforms -180 in z on top of -360 in x.