title: Finding the nearest location from a list of coordinates
body: <p>I would like to find the nearest location for a given address (user input) from an array of locations (lat, lng).</p>
  
  <p>(Or, even better, sort the lcoations by distance)</p>
  
  <p>I want to achieve this without displaying a map.
  I'm also not sure which Google API would be best suited for this (Geocoding API, Maps v3 etc.).</p>
  
  <p>What would be the best approach for this?</p>
  
  <p>If someone could point me in the right direction it would be greatly appreciated.</p>
  
  <p><strong>Locations:</strong></p>
  
  <pre><code>[
      {
          // Amsterdam
          "lat": 52.3702157,
          "lng": 4.8951679
      },
      {
          // Berlin
          "lat": 52.5200066,
          "lng": 13.404954
      },
      {
          // Brussels
          "lat": 50.85,
          "lng": 4.35
      },
      {
          // Paris
          "lat": 48.856614,
          "lng": 2.3522219
      },
      {
          // Madrid
          "lat": 40.4167754,
          "lng": -3.7037902
      }
  ]
  </code></pre>
  
  <p><strong>User input:</strong> <code>Antwerp</code></p>
  
  <pre><code>{
      "lat": 51.2194475,
      "lng": 4.4024643
  }
  </code></pre>
  
  <p><strong>Should return:</strong> <code>Brussels</code></p>
  
  <pre><code>{
      "lat": 50.85,
      "lng": 4.35
  }
  </code></pre>
  
  <p><strong>Or, sorted by distance:</strong></p>
  
  <pre><code>[
      {
          // Brussels
          "lat": 50.85,
          "lng": 4.35
      },
      {
          // Amsterdam
          "lat": 52.3702157,
          "lng": 4.8951679
      },
      {
          // Paris
          "lat": 48.856614,
          "lng": 2.3522219
      },
      {
          // Berlin
          "lat": 52.5200066,
          "lng": 13.404954
      },
      {
          // Madrid
          "lat": 40.4167754,
          "lng": -3.7037902
      }
  ]
  </code></pre>