Answers.Body: <p>This turned out to be an issue with a misconfigured Google API key.</p>
  <p>When setting up your Google API keys, make sure that:</p>
  <ul>
  <li>Your domain is whitelisted (including any staging servers).</li>
  <li>Your keys have granted permission to the necessary functionality.</li>
  </ul>
  <p>Be sure to read the <a href="https://plugins.doublesecretagency.com/smart-map/get-google-api-keys/" rel="nofollow noreferrer">full instructions</a> for how to set up your Google API keys.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2016-08-21T03:07:14.290Z
Answers.LastActivityDate: 2021-01-01T06:43:17.900Z
Answers.LastEditDate: 2021-01-01T06:43:17.900Z
Answers.UserDisplayName: Lindsey D
Body: <p>I am making a simple call to entries near a zip code using this url format:</p>
  
  <pre><code>example.com/locations-zip-ajax?near=93003
  </code></pre>
  
  <p>My template includes this code:</p>
  
  <pre><code>{% set target = craft.request.getParam('near') %}
  {% set params = {
    target: target|length ? target : 37212,
    range: target|length ? 30 : 7000,
  } %}
  {% set locations = craft.entries.section('locationsFeed').address(params).order('distance').find() %}
  
  {% for location in locations %}
        //do some stuff
  
  {% else %}
    &lt;li class="locations__item"&gt;
      &lt;h4&gt;No results found&lt;/h4&gt;
    &lt;/li&gt;
  
  {% endfor %}
  </code></pre>
  
  <p>But no matter what zip code is entered, the results are always in the same order and the nearest entry is always 5,828.2 miles away even if the result entry's zip code is identical to the 'near' param.</p>
  
  <p>I have ensured that my target param is being populated correctly and that my range param is working as well.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-08-16T19:23:17.267Z
Comments.Text: Hard to say... this could be an issue with your Google API keys. Ping me on [Craft Slack](https://craftcms.com/community#slack) (@lindseydiloreto), and I'll help you work through it. We'll report the solution back here.
Comments.UserDisplayName: Lindsey D
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-08-17T20:35:48.373Z
Comments.Text: waiting on being added to that team... Sent request. What is weird is that it worked perfectly for weeks and then stopped one day. I had to increase my range param to over 5k miles to see any results.
Comments.UserDisplayName: Shawn Cothran
Tags: <plugin-smartmap>
Title: Filter locations by zip in Smart Map
ThreadText: # Filter locations by zip in Smart Map
  
  (Asked by: username_0 on 2016-08-15)
  
  I am making a simple call to entries near a zip code using this url format:
  
  ```
  example.com/locations-zip-ajax?near=93003
  
  ```
  
  My template includes this code:
  
  ```
  {% set target = craft.request.getParam('near') %}
  {% set params = {
    target: target|length ? target : 37212,
    range: target|length ? 30 : 7000,
  } %}
  {% set locations = craft.entries.section('locationsFeed').address(params).order('distance').find() %}
  
  {% for location in locations %}
        //do some stuff
  
  {% else %}
    <li class="locations__item">
      <h4>No results found</h4>
    </li>
  
  {% endfor %}
  
  ```
  
  But no matter what zip code is entered, the results are always in the same order and the nearest entry is always 5,828.2 miles away even if the result entry's zip code is identical to the 'near' param.
  
  I have ensured that my target param is being populated correctly and that my range param is working as well.
  
  **Tags:** plugin-smartmap
  
  > **Comments:**
  > **username_1**: Hard to say... this could be an issue with your Google API keys. Ping me on [Craft Slack](https://craftcms.com/community#slack) (@lindseydiloreto), and I'll help you work through it. We'll report the solution back here.  
  > **username_0**: waiting on being added to that team... Sent request. What is weird is that it worked perfectly for weeks and then stopped one day. I had to increase my range param to over 5k miles to see any results.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-08-21. Score: 2 | Accepted answer
  
  This turned out to be an issue with a misconfigured Google API key.
  
  When setting up your Google API keys, make sure that:
  
  * Your domain is whitelisted (including any staging servers).
  * Your keys have granted permission to the necessary functionality.
  
  Be sure to read the [full instructions](https://plugins.doublesecretagency.com/smart-map/get-google-api-keys/) for how to set up your Google API keys.
  
  
  ---
  
  