title: Convert nautical miles to degrees longitude given a latitude using Google maps
body: <p>I want to explicitly define a Google maps <a href="http://code.google.com/apis/maps/documentation/javascript/reference.html#LatLngBounds" rel="nofollow">LatLngBounds</a> object to be x nautical miles to the right of a <a href="http://code.google.com/apis/maps/documentation/javascript/reference.html#LatLng" rel="nofollow">LatLong</a> P and x nautical miles left of P.  And define the LatLngBounds to be y nautical miles above the point P and y nm below P.</p>
  
  <p>So basically I want to define a LatLngBounds using latitude and longitude, and I want to get that latitude and longitude from x, y, and P.</p>
  
  <p>Degrees latitude converts to degrees longitude easily: 1 degree equals one nautical mile.  But<br>
  degrees longitude per nm changes with latitude.  The formula is (in php)</p>
  
  <pre><code>public static function degPerNmAtLat($lat) {
      $pi80 = M_PI / 180;
      $lat = $lat*$pi80; //convert lat to radians
      $p1 = 111412.84;        // longitude calculation term 1
      $p2 = -93.5;            // longitude calculation term 2
      $p3 = 0.118;            // longitude calculation term 3
      // below: calculate the length of a degree of latitude and longitude in meters
      $longlen = ($p1 * cos($lat)) + ($p2 * cos(3 * $lat)) +  ($p3 * cos(5 * $lat));
      $longlen = $longlen * (3.280833333) / (5280 * 1.15077945);  // convert to nautical miles
      return 1/$longlen;
  }
  </code></pre>
  
  <p>But this seems like a common task, and I wonder if Google maps has a function I am missing which would accomplish this.  Is there a native Google maps way to create my LatLngBounds object from x, y, and P without using the formula above?</p>