I'm trying to draw a circle in google map v2 for my project and use it
with google local search. But the map just doesn't show the circle.
the code below is my code... Please help me...

________________________________________________________________________

google.load('maps', '2.115');

var map;
var circle;

function OnLoad() {

   map = new google.maps.Map2(document.getElementById("Map"));
   map.addControl(new google.maps.MapTypeControl()); // Add the map
type control
   map.setMapType(G_HYBRID_MAP);
   map.enableContinuousZoom();
   map.enableScrollWheelZoom();
   map.setCenter(new google.maps.LatLng(3.058068, 101.688166), 15);

   var center = map.getCenter();

   circleRadius = 1;

   var circlePoints = Array();

   var d = circleRadius/6378.8; // radians

   var lat1 = (PI/180)* center.lat(); // radians
   var lng1 = (PI/180)* center.lng(); // radians

   for (var a = 0 ; a < 361 ; a++ ) {
      var tc = (PI/180)*a;
      var y = asin(sin(lat1)*cos(d)+cos(lat1)*sin(d)*cos(tc));
      var dlng = atan2(sin(tc)*sin(d)*cos(lat1),cos(d)-
sin(lat1)*sin(y));
      var x = ((lng1-dlng+PI) % (2*PI)) - PI ; // MOD function
      var point = new GLatLng(parseFloat(y*(180/PI)),parseFloat(x*(180/
PI)));
      circlePoints.push(point);
   }

   circle = new GPolygon(circlePoints, '#6699FF', 1, 1, '#CCCCFF',
0.25);

   map.addOverlay(circle);

}

google.setOnLoadCallback(OnLoad);
_________________________________________________________________________

or download the whole source code

http://www.mediafire.com/?0oznof98vormlfr


-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API V2" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-api?hl=en.

Reply via email to