title: How calculate geo bounding box from center coordinate and radius
body: <p>I have lat, long and radius of location:</p>
  <pre><code>lat = 38.7199877874397
  long = -116.717434703125
  radius = 6477937.81256012 - radius in metrs.
  </code></pre>
  <p>I need calculate geo bounding box for filtering in Elasticsearch according to this example:
  <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-bounding-box-query.html#query-dsl-geo-bounding-box-query" rel="nofollow noreferrer">https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-bounding-box-query.html#query-dsl-geo-bounding-box-query</a></p>
  <p>Geo bounding box, for example should look like</p>
  <pre><code>&quot;geo_bounding_box&quot;: {
            &quot;pin.location&quot;: {
              &quot;top_left&quot;: {
                &quot;lat&quot;: 40.73,
                &quot;lon&quot;: -74.1
              },
              &quot;bottom_right&quot;: {
                &quot;lat&quot;: 40.01,
                &quot;lon&quot;: -71.12
              }
            }
  </code></pre>
  <p>I try use this formula:</p>
  <pre><code>(X - dX, Y - dY) and (X + dX, Y + dY)
  Where:
  X - longitude
  Y - latitude
  dY = 360 * r / R - the earth radius is R, in the same units as r
  dX = dY * cos (radians (Y))
  </code></pre>
  <p>but i have wrong numbers:</p>
  <pre><code>((-397.59384191845777, -321.2800122125603), (164.1589725122078, 398.7199877874397))
  </code></pre>
  <p>How i cane calculate geo bounding box wright?
  Will be grateful for the help.</p>