title: How can I determine the distance between two sets of latitude/longitude coordinates?
body: <p>I am trying to write something that will determine the distance between to sets of lat/lon coordinates.</p>
  
  <p>I am using the following code which I found on <a href="https://stackoverflow.com/questions/378281/lat-lon-distance-heading-lat-lon">this site</a>:</p>
  
  <pre><code>public static double distance (double lat1, double lon1, double lat2, double lon2) { 
      double lat1 = Convert.ToDouble(latitude);
      double lon1 = Convert.ToDouble(longitude);
      double lat2 = Convert.ToDouble(destlat);
      double lon2 = Convert.ToDouble(destlon);
  
      double theta = toRadians(lon1-lon2); 
      lat1 = toRadians(lat1); 
      lon1 = toRadians(lon1); 
      lat2 = toRadians(lat2); 
      lon2 = toRadians(lon2); 
  
      double dist = sin(lat1)*sin(lat2) + cos(lat1)*cos(lat2)*cos(theta); 
      dist = toDegrees(acos(dist)) * 60 * 1.1515 * 1.609344 * 1000; 
  
      return dist; 
  } 
  </code></pre>
  
  <p>My problem is that I am running into the compile error <strong>"The name 'toRadians'/'cos'/'sin/'toDegrees' does not exist in the current context..."</strong> What am I doing wrong?</p>