How to achieve "spherical" mapping in procedural materials? What I have:

What I would want (sorry for a terrible sketch):

How to convert object/generated coordinates in such way?
If you just want the longitudes, the answers linked by @moonboots will suffice.. if you want to map a 2D procedural texture to a sphere, this sort of setup will do the Y dimension (latitudes) as well..