How can I loop through entries to successfully show static google maps for each entry?

My google maps field is {event_location}

Here is my template code:


{exp:{module}:entries channel="events" unit="passed" show_active="no" limit="6" status="open" paginate="bottom" orderby="low_events:end" sort="desc"}
<figure class="archive-event">
{exp:gmap:static_map markers="{event_location"}


At the moment it shows the default Google map and the entire geocode data.

Current result

Appreciate any help or guidance.

  • Are you getting JavaScript errors in your console? I would think running two maps, without individually identifying them, might cause JS conflicts? Jul 14, 2014 at 4:20
  • I get no errors in the console logs. If i change the code to: {exp:gmap:static_map markers="{New York, NY}"} that works. Jul 14, 2014 at 15:12
  • 1
    Just replying to the first comment for the sake of accuracy and others reading. Static Maps don't use JS, which is the whole point of using Static Maps (to avoid using JS). It basically just builds a dynamic query string (url) and passes it to the Google Static Maps API and an image is returned from their API, which can then be cached locally to speed up rendering in the future. Jul 14, 2014 at 17:14

1 Answer 1


The reason this isn't working is because the data that is stored in that database column is a JSON string. This isn't the desired behavior you are seeking. Here are some things to consider, which I think will help you get it working properly.

  1. You don't need brackets surrounding your markers string. There is no reason for brackets unless you are parsing a variables containing an address string or lat/lng coordinates.

  2. You can use the FT to output the formatted address string or the latitude and longitude into the markers parameter.

    {exp:gmap:static_map markers="{event_location:formatted_address}" width="400" height="300"}


  3. The FT also comes with Static Map outputs baked into the FT tag itself, so it's even easier than above. This will convert markers, routes, and regions into the a static map, so it's real dynamic yet easy to implement.

    {event_location:static_map width="400" height="300"}


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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