Thanks a lot, Eric! I just solved it! There was a mistake here: circleRadius= (radius/1000); //km
The right version is: circleRadius= (radius); //km (For it I didn't see the disk!) Anyway thanks for the prompt answer :) Giorgio On 6 Ott, 19:07, "Eric Ayers" <[EMAIL PROTECTED]> wrote: > Hi Giorgio, > > It doesn't look like you are using the Google Web Toolkit > (GWT),<http://code.google.com/webtoolkit>but straight JavaScript. > > Searching the Maps group > <http://groups.google.com/group/Google-Maps-API>might be of some help, > but keep in mind that the Maps forum has some posting > guidelines you should check out before posting a message there. > > > > On Mon, Oct 6, 2008 at 11:21 AM, atpco81 <[EMAIL PROTECTED]> wrote: > > > 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 > > -- > Eric Z. Ayers - GWT Team - Atlanta, GA USAhttp://code.google.com/webtoolkit/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
