title: How do I use DynamoDB for geo-location based queries?
body: <p>I'm designing a photo sharing app (location based). I plan to use AWS Cognito for authentication/authorization, DynamoDB for persistent data, S3 for file storage, and Lambda + API Gateway for web services.</p>
  
  <p>These are the key use-cases/access patterns (other than sign-up/sign-in):</p>
  
  <ol>
  <li>User creates a post: title, media, location (lat,lon)</li>
  <li>Users fetch a list of posts closest to their geo-location (newest first)</li>
  </ol>
  
  <p>These are the Tables that I'm going to create:</p>
  
  <pre><code>Users table
  hash-key=userID from cognito
  
  Posts table
  hash-key=userID from cognito
  range-key=date
  other-attributes=title, image-s3-path, ge-location
  </code></pre>
  
  <p>What is the best way to implement a query (perhaps with the help of adding LSI, GSI, or even more tables), so that the result is a collection of posts based on users's current location. Eg. show only posts within 10 km of radius, sorted by newest first.</p>