" var rLat = (radius/3963.189) * (180/PI)" Can anyone explain how did we come up with this *rlat formula* and what value does *radius/earth's radius gives*
On Tuesday, July 5, 2011 at 7:53:44 PM UTC+5:30, Karthik Reddy wrote: > > function getCirclePoints(center,radius){ > > var circlePoints = Array(); > > var searchPoints = Array(); > > var bounds = new google.maps.LatLngBounds(); > > with (Math) { > > var rLat = (radius/3963.189) * (180/PI); // miles > > var rLng = rLat/cos(center.lat() * (PI/180)); > > for (var a = 0 ; a < 361 ; a++ ) { > > var aRad = a*(PI/180); > > var x = center.lng() + (rLng * cos(aRad)); > > var y = center.lat() + (rLat * sin(aRad)); > > var point = new google.maps.LatLng(parseFloat(y),parseFloat(x),true); > > circlePoints.push(point); > > bounds.extend(point); > > if (a % pointInterval == 0) { > > searchPoints.push(point); > > } > > } > > } > > searchPolygon = new google.maps.Polygon({ > > paths: circlePoints, > > strokeColor: '#0000ff', > > strokeOpacity: 1, > > strokeWeight: 1, > > fillColor: '#0000ff', > > fillOpacity: 0.2 > > }); > > searchPolygon.setMap(map); > > map.fitBounds(bounds); > > > //map.setCenter(searchPolygon.getBounds().getCenter(),map.getBoundsZoomLevel(searchPolygon.getBounds())); > > return searchPoints; > > } > -- You received this message because you are subscribed to the Google Groups "[deprecated] Google Maps JavaScript API v3. Please use the latest post." group. To unsubscribe from this group and stop receiving emails from it, send an email to google-maps-js-api-v3+unsubscr...@googlegroups.com. To post to this group, send email to google-maps-js-api-v3@googlegroups.com. Visit this group at https://groups.google.com/group/google-maps-js-api-v3. For more options, visit https://groups.google.com/d/optout.