Why was the global positioning system invented?

The global positioning system was invented as a military tool for use in combat operations. It then expanded to regular society.