• Home
    • About Us
    • Contact
  • Setting up a Program
  • Community Boating, Boston program
    • Adult Program course
    • Student page
    • CBI Mentors
  • RC Boats
    • Model RC Boat options
    • OnBoard Electronics
  • Computers & Electronics
    • Electronics Suppliers
  • Sailing Principles
  • On The Water Challenges
  • Costs & Materials
  • Curriculum
    • Model Boat exercises
  • Resources & References
  • Gallery

USING GPS

Converting GPS to Distance


Parallax GPS Module PMB-648

http://www.movable-type.co.uk/scripts/latlong.html


Equirectangular approximationIf performance is an issue and accuracy less important, for small distances Pythagoras’ theorem can be used on an equirectangular projection:*

Formula

x = Δλ.cos(φ)
y = Δφ
d = R.√x² + y²



JavaScript:
 var x = (lon2-lon1) * Math.cos((lat1+lat2)/2);
 var y = (lat2-lat1);
 var d = Math.sqrt(x*x + y*y) * R;

(lat/lon in radians!)This uses just one trig and one sqrt function – as against half-a-dozen trig functions for cos law, and 7 trigs + 2 sqrts for haversine. Accuracy is somewhat complex: along meridians there are no errors, otherwise they depend on distance, bearing, and latitude, but are small enough for many purposes* (and often trivial compared with the spherical approximation itself).

✕