hello !

My problem is that i can't draw a circle on my map with the following
code
I m really newbie using google map and js so please be indulgent ^^
the map is well displayed but no circle ...

this is the whole code :
the code is include in a php string so you will see $map which is an
array containing some information about what to display
$map['lat'] and $map['lon'] are coordinates of the center of the
wished circle
$map[radius] the radius...


<script type=\"text/javascript\">



                        var map;


                        function initialize() {
                        if (GBrowserIsCompatible()) {

                        map = new 
GMap2(document.getElementById(\"map_canvas\"));
                        map.setCenter(new GLatLng(".$map['lat'].", 
".$map['lon']."),".
$map['zoom'].");
                        map.setUIToDefault();
                        drawCircle();


                        }
                        }



                        function drawCircle(){
            var centerPoint = new GLatLng(".$map['lat'].",".
$map['lon'].");
            var circlePoints = Array();

            with (Math) {
                        var radius = ".$map['radius'].";

                        for (var a = 0 ; a < 361 ; a+=10 ) {
                        var aRad = a*(PI/180);
                        y = ".$map['lat']." + radius * sin(aRad)
                        x = ".$map['lon']." + radius * cos(aRad)

                        circlePoints.push(new GLatLng(x,y));
                        }

                        map.removeOverlay(circleLine);
                        circleLine = new GPolyline(circlePoints,'#FD942D',1,
                        5);
                        map.addOverlay(circleLine);
            }

                        }



                        </script>


(i can't give you the link of the map because it's only in local for
the moment)

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API" 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