<p>This is a shot in the dark, so let me know if this does/doesn't work...</p>

<p>Here's how you're starting your loop:</p>

<pre><code>$.each( smartMap.marker, function( key, value ) {
</code></pre>

<p>And near the end, you reference a <code>marker</code> object:</p>

<pre><code>circle.bindTo('center', marker, value.getPosition());
</code></pre>

<p>But as far as I can tell, <code>marker</code> is never defined. Did you mean to pass in <code>value</code> instead?</p>

CC BY-SA 4.0
2018-11-24T15:23:04.417Z
Yes, that shouldn't say marker, that should say value, but i was changing some stuff and forgot to change it back before pasting this code. It doesn't work with value there.
John
CC BY-SA 4.0
2018-11-24T06:27:20.263Z
2018-11-24T06:27:20.263Z
Lindsey D
<p>So, I'm trying to set circles around marker locations using Smart Map and some JS.</p>
<p>I've got the following which gives no errors, but outputs no circles.</p>
<pre><code>$(function () {

  $.each( smartMap.marker, function( key, value ) {

    var circle = new google.maps.Circle({
                    map: smartMap.map['smartmap-mapcanvas-1'],
                    radius: 40233,    // 25 miles in metres
                    fillColor: '#000000'
                 });
    circle.bindTo('center', marker, value.getPosition());

    });

  });

});
</code></pre>
<p>I'm out of ideas at this point!</p>

CC BY-SA 4.0
2018-11-24T06:20:47.360Z
I haven't used Circle, but most of what you're doing is outside of Smart Map. You're largely just using the native Google Maps API here.
Lindsey D
CC BY-SA 4.0
2018-11-24T15:24:35.573Z
Yeah, i think this should work just fine, but isn't, so i was trying to narrow it down in case there was some smart map edge case i didn't know about.
John
<javascript><plugin-smartmap>
Setting Google maps circles using Smart Map plugin
# Setting Google maps circles using Smart Map plugin

(Asked by: username_0 on 2018-11-23)

So, I'm trying to set circles around marker locations using Smart Map and some JS.
I've got the following which gives no errors, but outputs no circles.
$(function () {

  $.each( smartMap.marker, function( key, value ) {

    var circle = new google.maps.Circle({
                    map: smartMap.map['smartmap-mapcanvas-1'],
                    radius: 40233,    // 25 miles in metres
                    fillColor: '#000000'
                 });
    circle.bindTo('center', marker, value.getPosition());

    });

  });

});

I'm out of ideas at this point!

**Tags:** javascript, plugin-smartmap
> **Comments:**
> **username_1**: I haven't used Circle, but most of what you're doing is outside of Smart Map. You're largely just using the native Google Maps API here.  
> **username_0**: Yeah, i think this should work just fine, but isn't, so i was trying to narrow it down in case there was some smart map edge case i didn't know about.  

---

## 1 answers

### Answer by username_1 on 2018-11-24. Score: 1

This is a shot in the dark, so let me know if this does/doesn't work...
Here's how you're starting your loop:
$.each( smartMap.marker, function( key, value ) {

And near the end, you reference a marker object:
circle.bindTo('center', marker, value.getPosition());

But as far as I can tell, marker is never defined. Did you mean to pass in value instead?

> **Comments:**
> **username_0**: Yes, that shouldn't say marker, that should say value, but i was changing some stuff and forgot to change it back before pasting this code. It doesn't work with value there.  

---

