1

So, I'm trying to set circles around marker locations using Smartmap 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!

  • 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 Nov 24 '18 at 6:20
  • 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 Nov 24 '18 at 15:24
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?

  • 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 Nov 24 '18 at 15:23

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.