I am making a simple call to entries near a zip code using this url format:


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>

{% 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.

  • Hard to say... this could be an issue with your Google API keys. Ping me on Craft Slack (@lindseydiloreto), and I'll help you work through it. We'll report the solution back here.
    – Lindsey D
    Aug 16, 2016 at 19:23
  • 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. Aug 17, 2016 at 20:35

1 Answer 1


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 for how to set up your Google API keys.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.