title: How does Geofire calculate bounding geohashes for Firebase queries?
body: <p><strong>Context</strong></p>
  
  <p>I've used Geofire along with Firebase for a while now and I got really curious how Geofire performs its queries. I understand that semantically, it's a function of coordinates and a radius that results in a minimum and maximum hashes. So the way I think it works in conjuncture with Firebase would look like this</p>
  
  <pre><code>ref.child("users").orderByChild("g").startAt(minHash).endAt(maxHash).on('child_added', function(snapshot) { /* retrieved snapshot contains the geohashes in range */ });
  </code></pre>
  
  <p>Where these two (min and max) geohashes are calculated off the given inputs. Now here comes the question</p>
  
  <p><strong>Question(s)</strong></p>
  
  <p>Assuming that what I stated above is correct, how are these two geohashes calculated? How do they return results within a certain <em>circular</em> region when geohashes typically represent bounding rectangles? And finally, how can two geohashes of different sizes have the same center?</p>
  
  <p>To clarify on that last part: consider the following image</p>
  
  <p><a href="https://i.stack.imgur.com/MsQJh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MsQJh.png" alt="Typical geohashing steps"></a></p>
  
  <p>Since geohashing works by halving regions into smaller regions, how can two hashes of different sizes (min and max) have the same center points?</p>
  
  <p><strong>Assumptions</strong></p>
  
  <p>I thought that maybe it's as simple as increasing/decreasing the raw value of the hash, but that doesn't make much sense since the increase/decrease should be relative to the size of the hash (the "zoom" level so to speak) and the query radius, if I'm not mistaken.</p>