<p>Looks like there are a couple of notable errors in your JS:</p>

<ul>
<li>You have a semi-colon at the end of your <code>icon</code> line. That should be a comma.</li>
<li>On the <code>scaledSize</code> line, you have the colon <em>inside</em> the quote. That should be outside.</li>
<li><em>Added per Robin's comment...</em> Since you're doing this in JS (not Twig), the <code>new google.maps.Size(32,32)</code> shouldn't be enclosed in quotes. Pass in the JS object directly.</li>
</ul>

<p>Try something like this...</p>

<pre class="lang-js prettyprint-override"><code>{% js %}
    var markerId = 'smartmap-mapcanvas-1.{{ entry.id }}.addressInformation';
    smartMap.marker[markerId].setOptions({
        'icon':       '{{ icon }}',
        'scaledSize': new google.maps.Size(32,32)
    });
{% endjs %}
</code></pre>

CC BY-SA 4.0
2020-09-17T22:03:20.390Z
This is the correct answer
Tchick
CC BY-SA 4.0
2018-08-24T16:09:31.010Z
2018-08-24T16:09:31.010Z
Lindsey D
<p>You already stated the wrong ; </p>

<p>Aside from that, i managed to change the size in one of my projects, where i had to use a bitmap image, this way:</p>

<pre><code>marker[id] = new google.maps.Marker({
    position: region.pos,
    map: map,
    icon: {url: imageMarker,
            size: new google.maps.Size(52, 52),
            scaledSize: new google.maps.Size(32, 32),
            anchor: new google.maps.Point(15, 35) // offset
            }
});
</code></pre>

<p>I didn't use the smartmaps-plugin, but i think that's irelevant.</p>

<p>(The png had a different size, that's the reason <code>size</code> and <code>scaledSize</code> have different values)</p>

CC BY-SA 4.0
2018-08-24T12:30:37.193Z
Tried as suggested. Code seems to be OK, no errors. But unfortunately still no sizing
Robbie Post
CC BY-SA 4.0
2018-08-24T09:40:11.660Z
2018-08-24T09:40:11.660Z
phaetons
<p>I tried this code, but getting 'unexpected token errors". Probably something to do using incorrect syntax.</p>

<pre class="lang-js prettyprint-override"><code>{% js %}
    var markerId = 'smartmap-mapcanvas-1.{{ entry.id }}.addressInformation';
    smartMap.marker[markerId].setOptions({
        'icon':       '{{ icon }}'; 
        'scaledSize:' 'new google.maps.Size(32,32)'
    });
{% endjs %}
</code></pre>

<p>The error in the console</p>

<pre class="lang-js prettyprint-override"><code>var markerId = 'smartmap-mapcanvas-1.550.addressInformation';
smartMap.marker[markerId].setOptions({
    'icon':       '//d1ado4imyxw3fk.cloudfront.net/html/pin-otto-12.png'; 
    'scaledSize:' 'new google.maps.Size(32,32)'
})
</code></pre>

CC BY-SA 4.0
2018-08-24T07:55:43.423Z
Did you made mistakes while copy pasting? Because your syntax doesn't seem correct unless smartmap is using `eval` but even so using `;` after object properties is wrong
Robin Schambach
CC BY-SA 4.0
2018-08-24T08:35:01.813Z
The above is the smart map code as described in the smartmap docu under: Different icons for different marker types. I did make a mistake though with the ; character. After replacing the ; for a , the map reloads without errors. However the icons are still not sized.
Robbie Post
CC BY-SA 4.0
2018-08-24T08:38:45.827Z
They don't state to do `'new google.maps.Size(32,32)'` because that will pass a string... I can't think of a reason why smartmap expects a string rather than the actual object.
Robin Schambach
CC BY-SA 4.0
2018-08-24T12:54:29.353Z
it should be: 
'scaledSize': new google.maps.Size(32,32)

(wrong postion of the colon, value is not a string)
phaetons
CC BY-SA 4.0
2018-08-24T16:10:58.127Z
@RobinSchambach Smart Map is actually smart enough to recognize strings that contain `google.maps`, and parse them correctly. :)
Lindsey D
CC BY-SA 4.0
2018-08-24T16:11:53.893Z
Oh, but that would be in Twig... he's using JS here. In that case, you are correct about passing the object directly!
Lindsey D
CC BY-SA 4.0
2020-09-17T22:01:14.070Z
This thread is a little old but I found it helpful in solving this same issue. @LindseyD hit on the solution. Pass the object directly instead of as a string.
In other words remove the quote marks like this:
'scaledSize': new google.maps.Size(32,32)
 
Works for me!
Tchick
<craft3><plugin-smartmap>
How can I change the size of an individual pin?
# How can I change the size of an individual pin?

(Asked by: username_0 on 2018-08-24)

I tried this code, but getting 'unexpected token errors". Probably something to do using incorrect syntax.
{% js %}
    var markerId = 'smartmap-mapcanvas-1.{{ entry.id }}.addressInformation';
    smartMap.marker[markerId].setOptions({
        'icon':       '{{ icon }}'; 
        'scaledSize:' 'new google.maps.Size(32,32)'
    });
{% endjs %}

The error in the console
var markerId = 'smartmap-mapcanvas-1.550.addressInformation';
smartMap.marker[markerId].setOptions({
    'icon':       '//d1ado4imyxw3fk.cloudfront.net/html/pin-otto-12.png'; 
    'scaledSize:' 'new google.maps.Size(32,32)'
})

**Tags:** craft3, plugin-smartmap
> **Comments:**
> **username_1**: Did you made mistakes while copy pasting? Because your syntax doesn't seem correct unless smartmap is using `eval` but even so using `;` after object properties is wrong  
> **username_0**: The above is the smart map code as described in the smartmap docu under: Different icons for different marker types. I did make a mistake though with the ; character. After replacing the ; for a , the map reloads without errors. However the icons are still not sized.  
> **username_1**: They don't state to do `'new google.maps.Size(32,32)'` because that will pass a string... I can't think of a reason why smartmap expects a string rather than the actual object.  
> **username_2**: it should be:  'scaledSize': new google.maps.Size(32,32)  (wrong postion of the colon, value is not a string)  
> **username_3**: @RobinSchambach Smart Map is actually smart enough to recognize strings that contain `google.maps`, and parse them correctly. :)  
> **username_3**: Oh, but that would be in Twig... he's using JS here. In that case, you are correct about passing the object directly!  
> **username_4**: This thread is a little old but I found it helpful in solving this same issue. @LindseyD hit on the solution. Pass the object directly instead of as a string. In other words remove the quote marks like this: 'scaledSize': new google.maps.Size(32,32)   Works for me!  

---

## 2 answers

### Answer by username_3 on 2018-08-24. Score: 3

Looks like there are a couple of notable errors in your JS:

You have a semi-colon at the end of your icon line. That should be a comma.
On the scaledSize line, you have the colon inside the quote. That should be outside.
Added per Robin's comment... Since you're doing this in JS (not Twig), the new google.maps.Size(32,32) shouldn't be enclosed in quotes. Pass in the JS object directly.

Try something like this...
{% js %}
    var markerId = 'smartmap-mapcanvas-1.{{ entry.id }}.addressInformation';
    smartMap.marker[markerId].setOptions({
        'icon':       '{{ icon }}',
        'scaledSize': new google.maps.Size(32,32)
    });
{% endjs %}

> **Comments:**
> **username_4**: This is the correct answer  

---

### Answer by username_2 on 2018-08-24. Score: 1

You already stated the wrong ; 
Aside from that, i managed to change the size in one of my projects, where i had to use a bitmap image, this way:
marker[id] = new google.maps.Marker({
    position: region.pos,
    map: map,
    icon: {url: imageMarker,
            size: new google.maps.Size(52, 52),
            scaledSize: new google.maps.Size(32, 32),
            anchor: new google.maps.Point(15, 35) // offset
            }
});

I didn't use the smartmaps-plugin, but i think that's irelevant.
(The png had a different size, that's the reason size and scaledSize have different values)

> **Comments:**
> **username_0**: Tried as suggested. Code seems to be OK, no errors. But unfortunately still no sizing  

---

