0

I want to add a geofence in gmap3. I thought the most basic way would be to draw a circle and check if the marker is within the bounds of the circle, when the marker is added.

I added a circle

var fence = $('#dispatcher').gmap3(
  { action: 'addCircle',
    circle:{
      options:{
        center: [53.99212, -1.541812],
        radius : 3000,
        fillColor : "#FFAF9F",
        strokeColor : "#FF512F" 
      }
    }
  }
);

Any idea how would I get the bounds to check against?

Vince Lowe
  • 3,521
  • 7
  • 36
  • 63

1 Answers1

0

Maybe using

circle.getBounds();

it's listed here Google maps V3 API, then using contains(latLng:LatLng)

Cristiano Fontes
  • 4,920
  • 6
  • 43
  • 76
  • cheers, this is the method i want to use. My issue is implementation. how can i select the circle to call getBounds() – Vince Lowe Oct 08 '12 at 18:21
  • Surely the fence var should have some kind of reference to the actual Gmaps Circle obj, have you tried to use firebug or Chrome inspector in that obj ? – Cristiano Fontes Oct 10 '12 at 11:51