Hi all, I'm a newbie and this could be a very simple question: How could I draw a circle in a maps if I know its center and radius?
I use JS and I do a circle using the distance from two different points as, but I want to use a function like this example: http://maps.forum.nu/gm_sensitive_circle2.html I have been trying to work with this function but it doesn't work! function drawCircleFromRadius(){ if (circleLine) { map.removeOverlay(circleLine); } var bounds = new GLatLngBounds(); var circlePoints = Array(); centerPoint= center.getPoint(); map.setCenter(centerPoint); with (Math) { circleRadius= (radius/1000); //km var d = circleRadius/6378.8; // radians var lat1 = (PI/180)* centerPoint.lat(); // radians var lng1 = (PI/180)* centerPoint.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); bounds.extend(point); } if (d < 1.5678565720686044) { circle = new GPolygon(circlePoints, '#000000', 2, 1, '#000000', 0.25); } else { circle = new GPolygon(circlePoints, '#000000', 2, 1); } map.addOverlay(circle); map.setZoom(map.getBoundsZoomLevel(bounds)); } } Is it a problem of Google API version(I use the v.2.x)? Have you got another examples ? Cheers Giorgio --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" 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-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
