This project uses an Adafruit GPS hat plugged into a Raspberry Pi 2. It uses Windows 10 IoT build 14393 and the class library provided by Adafruit for accessing GPS coordinates and other available data.
The application is based around calculating distance along a sphere (planet Earth is nearly a sphere) from the GPS device to the putting green area of a golf course in southern Arizona, USA.
While the code is based on the sport of golf, the concepts and hard-coded locations can be adapted to any distance calculation needs.
The latitude and longitude values in the code were obtained from Google Maps but could, of course, be acquired from any mapping software and need not be specific to this golf course.
The cGeo class in the code implements three unique equations for calculating distance between two sets of coordinates. The Haversine, Spherical Law of Cosines and Spherical Earth Projection. Each has pros/cons based on execution speed and accuracy. It is based on the fact the earth is nearly a sphere. So, calculating distances between is not an exact straight line. Probably not so critical when calculating short distances. Links to where the code came from on the internet are inline with the code comments in the source.