I have found the answer for basic turning GPS ON/OFF.
Turning on and off GPS programmatically in android 4.0 and above?
But this does not really correspond to all location setting one finds in the Settings system app. In particular there are:
1) Use Wireless Networks 2) Use GPS Satellites 3) Location and Google Services.
The code to switch on/off refers to which of the three? what about the other two? How can those be turned on/off programatically?