<p>I'm trying to output a static map from a smart map field in a matrix. I can output a dynamic map with no issues, but the static map code isn't working.</p>

<p>Here is my code:</p>

<pre><code>{% set locations = entry.locationsAndNotes %}
{% set options = {
    width: 370,
    height: 208,
    zoom: 16,
} %}
{{ craft.smartMap.img(locations[0], options) }}
</code></pre>

<p>The url it outputs looks like this: <a href="https://maps.googleapis.com/maps/api/staticmap?visual_refresh=true&amp;key=myKey&amp;scale=2&amp;center=-48.876667,-123.393333&amp;size=370x208&amp;maptype=roadmap&amp;zoom=16" rel="nofollow noreferrer">https://maps.googleapis.com/maps/api/staticmap?visual_refresh=true&amp;key=myKey&amp;scale=2&amp;center=-48.876667,-123.393333&amp;size=370x208&amp;maptype=roadmap&amp;zoom=16</a>
Pasted into a browser, i get an error that the API server rejected my request because it is missing the size parameter.</p>

<p>If I change all of the <code>&amp;amp</code> to &amp;, an image loads, but it's just a blank blue map.</p>

<p>It seems like this should work, since I can render a dynamic map, but I'm not sure if it's an issue with my code, or the plugin, or the api.</p>

CC BY-SA 3.0
2017-09-12T19:33:45.703Z
If you change `craft.smartMap.img` to `craft.smartMap.map`, you're saying it loads the dynamic map properly? Does the marker appear in the correct spot?
Lindsey D
CC BY-SA 3.0
2017-09-12T19:49:05.697Z
@LindseyD Yes, changing it to craft.smartMap.map loads the dynamic map with the marker in the correct spot.
artmem
CC BY-SA 3.0
2017-09-12T20:05:28.530Z
Looks like a bug... contact support@doublesecretagency.com.
Lindsey D
CC BY-SA 3.0
2018-01-25T17:31:24.270Z
for anyone else that comes across this issue in the future - I ran into the same problem, and I needed to a) generate a google-maps API key and b) *enable certain APIs* in the google api settings - do the stuff on this page: https://plugins.doublesecretagency.com/smart-map/get-google-api-keys/ - the Google Static Maps API is *not* enabled by default.
SamC
<plugin-smartmap><google-maps>
Smart Maps problems displaying static maps
# Smart Maps problems displaying static maps

(Asked by: username_0 on 2017-09-12)

I'm trying to output a static map from a smart map field in a matrix. I can output a dynamic map with no issues, but the static map code isn't working.
Here is my code:
{% set locations = entry.locationsAndNotes %}
{% set options = {
    width: 370,
    height: 208,
    zoom: 16,
} %}
{{ craft.smartMap.img(locations[0], options) }}

The url it outputs looks like this: https://maps.googleapis.com/maps/api/staticmap?visual_refresh=true&key=myKey&scale=2&center=-48.876667,-123.393333&size=370x208&maptype=roadmap&zoom=16
Pasted into a browser, i get an error that the API server rejected my request because it is missing the size parameter.
If I change all of the & to &, an image loads, but it's just a blank blue map.
It seems like this should work, since I can render a dynamic map, but I'm not sure if it's an issue with my code, or the plugin, or the api.

**Tags:** plugin-smartmap, google-maps

> **Comments:**
> **username_1**: If you change `craft.smartMap.img` to `craft.smartMap.map`, you're saying it loads the dynamic map properly? Does the marker appear in the correct spot?  
> **username_0**: @LindseyD Yes, changing it to craft.smartMap.map loads the dynamic map with the marker in the correct spot.  
> **username_1**: Looks like a bug... contact support@doublesecretagency.com.  
> **username_2**: for anyone else that comes across this issue in the future - I ran into the same problem, and I needed to a) generate a google-maps API key and b) *enable certain APIs* in the google api settings - do the stuff on this page: https://plugins.doublesecretagency.com/smart-map/get-google-api-keys/ - the Google Static Maps API is *not* enabled by default.  

---

## 0 answers

