Wow, thanks. That was exactly what I was looking for. I reduced it to
this, I didn't use the MStatusControl but didn't know if the copyright
notice was still required for use of this. Please let me know. Thanks.
var opacity = 0.4;
var circle;
var centerMarker;
var circleUnits = 'MI'; //can be 'MI' for miles OR 'KM' km
kilometers
var circleRadius = 250; // radius you want if it's static
function doDrawCircle(){
if (circle) {
map.removeOverlay(circle);
}
if (centerMarker) {
map.setCenter(centerMarker.getLatLng())
}
var bounds = new GLatLngBounds();
var circlePoints = Array();
var d = circleRadius/3963.189; // radians
with (Math) {
var lat1 = (PI/180)* endlocation.lat(); // radians
var lng1 = (PI/180)* endlocation.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));
}
}
doDrawCircle();
On Sep 24, 5:10 pm, Marcelo <[email protected]> wrote:
> http://maps.forum.nu/gm_sensitive_circle2.html
>
> --
> Marcelo -http://maps.forum.nu
> --
>
> On Sep 24, 9:53 pm, "[email protected]"
>
> <[email protected]> wrote:
> > I found this code
> > herehttp://maps.examples.googlepages.com/highlightmarker.html
> > and got it to make a circle at a point but the size is based on the
> > zoom level (I think) as opposed to a unit like miles or kilometers I
> > was wondering how much work or where I'd go about changing it to base
> > it on miles or kilometers. How I'm using it can be seen
> > here:http://www.jove.com/resource/php/videographers/this_videographer2.php.
> > Thanks for any help you can offer.
>
> > function highlightCurrentMarker() {
> > var polyPoints = Array();
> > var mapNormalProj = G_NORMAL_MAP.getProjection();
> > var mapZoom = map.getZoom();
> > var clickedPixel =
> > mapNormalProj.fromLatLngToPixel(endlocation,
> > mapZoom);
> > alert (clickedPixel);
> > var polySmallRadius = 100;
> > var polyNumSides = 20;
> > var polySideLength = 18;
> > for (var a = 0; a < (polyNumSides+1); a++) {
> > var aRad = polySideLength*a*(Math.PI/180);
> > var polyRadius = polySmallRadius;
> > var pixelX = clickedPixel.x + polyRadius *
> > Math.cos(aRad);
> > var pixelY = clickedPixel.y + polyRadius *
> > Math.sin(aRad);
> > var polyPixel = new GPoint(pixelX,pixelY);
> > var polyPoint =
> > mapNormalProj.fromPixelToLatLng
> > (polyPixel,mapZoom);
> > polyPoints.push(polyPoint);
> > }
> > // Using GPolygon(points, strokeColor?,
> > strokeWeight?,
> > strokeOpacity?, fillColor?, fillOpacity?)
> > highlightCircle = new GPolygon(polyPoints,"#000000",
> > 2,1.0,"#0000FF",.5);
> > map.addOverlay(highlightCircle);
> > }
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---