View difference between Paste ID: DnLqzMZx and
SHOW:
|
|
- or go back to the newest paste.
1 | - | |
1 | + | <script language="javascript" type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> |
2 | <script language="javascript" type="text/javascript" src="/js/latlon.js"></script> | |
3 | <script language="javascript" type="text/javascript"> | |
4 | function drawCircle(center, radius, nodes, liColor, liWidth, liOpa, fillColor, fillOpa){ | |
5 | nodes = nodes||40; | |
6 | // Convert radius miles to km | |
7 | // comment out line below if inputting km | |
8 | radius *= 1.609344; | |
9 | var points = []; | |
10 | var step = parseInt(360/nodes)||10; | |
11 | var p1 = new LatLon(center.lat(), center.lng()); | |
12 | for(var i=0; i<=360; i+=step){ | |
13 | returned = p1.destinationPoint(i, radius); | |
14 | var pint = new google.maps.LatLng(returned._lat,returned._lon); | |
15 | points.push(pint); | |
16 | } | |
17 | points.push(points[0]); | |
18 | circle = new google.maps.Polygon({ | |
19 | paths: points, | |
20 | strokeColor: liColor||"#0055ff", | |
21 | strokeOpacity: liOpa||.7, | |
22 | strokeWeight: liWidth||2, | |
23 | fillColor: fillColor||"#0055ff", | |
24 | fillOpacity: fillOpa||.4 | |
25 | }); | |
26 | circle.setMap(map); | |
27 | } | |
28 | </script> |