GPS devices communicate via a NMEA (National Marine Electronic Association) spec which costs about $250.
see also:
Suppliers:
Garmin GPS 16/17 to DB9 PC serial port
interconnect:
Here is a Javascript function to calculate distance in miles. Change the multiplier to equal the number of your preferred units in one mile. For example, to get results in feet the multiplier would be 5280.
function calcDist(lon1,lat1,lon2,lat2) { var r = 3963.0; var multiplier = 1; return multiplier * r * Math.acos(Math.sin(lat1/57.2958) * Math.sin(lat2/57.2958) + Math.cos(lat1/57.2958) * Math.cos(lat2/57.2958) * Math.cos(lon2/57.2958 - lon1/57.2958)); }:
See:
Interested: