google maps draw circle from

google-maps, google-maps-api-3

Solution

So, the questions are:

a) What should I put in the "radius:" option?

Use the geometry library computeDistanceBetween() to find the radius (passing in your two points)

b) How can I center the zoom around the circle? "Bounds.Extend" will not do it

Once you have created the circle, you can call the getBounds() method on it to get its bounds

Problem

I need to draw a circle in google Maps V3 but I have 2 coordinates, the center and the outter position. Problem is the API expects center and "radius". For example: ``` var myCirclePath = []; myCirclePath.push(new google.maps.LatLng(18.111111,66.111111)); myCirclePath.push(new google.maps.LatLng(18.223344,66.222222)); var myCircle = new google.maps.Circle({ center: myCirclePath[0], radius: // what do I put here???? map: map }); ``` I searched around the web and find a lot of stuff about radians, degrees, sin, atan, and what not... however, I'm not good at math and I'm totally lost. So, the questions are: a) What should I put in the "radius:" option? b) How can I center the zoom around the circle? "Bounds.Extend" will not do it

Original source