Source Code for Me (s-c.me)

Allows you to paste souce code to blogs! Adapted for Twitter! Here is Search Form in case you missed your code.
Code:
Selected Language:
Show Linenumbers:
Short link for Twitter:
HTML:

HTML view:

Copy Source | Copy HTML
  1. function GCD1(lat1, lon1, lat2, lon2) {
  2. // Return Great Circle Distance between points calculation
  3.   function radians(a) {
  4.     var outNum =Math.PI*a/180;
  5.     return outNum;
  6.   }
  7.   var R = 6372.795;
  8.   var d1=Math.sin(radians(lat1))*Math.sin(radians(lat2))+Math.cos(radians(lat1))*Math.cos(radians(lat2))*Math.cos(radians(lon2)-radians(lon1));
  9.   var d2=Math.cos(radians(lat2))*Math.sin(radians(lon2)-radians(lon1));
  10.   var d3=Math.cos(radians(lat1))*Math.sin(radians(lat2))-Math.sin(radians(lat1))*Math.cos(radians(lat2))*Math.cos(radians(lon2)-radians(lon1));
  11.   var len=R*Math.atan2(Math.sqrt(d2*d2+d3*d3),d1);
  12.   return len;
  13. }​




Based on Manoli.Net's CodeFormatter. Made by Topbot (c) 2008-2016